I had exactly the same issues Gonzalo - It was not so much returning garbage as 
causing a crash as the static tables (_toFloat and _eLut) seemed not to be 
there in a DLL under Windows (ie, they were just a pointer into memory the 
process did not own).

If you check in this message archive (under Re: [Openexr-devel] Strange issue 
with half and _toFloat array) you will see I noticed that there was a comment 
in createDll.cpp not being able to support this sort of functionality.

The proposed solution from Piotr was to use cmake to generate the SLN/VCProj 
files (which do not rely on the createDll functionality) but I had issues with 
cmake not defining PLATFORM_WINDOWS (as mentioned just recently, and easily 
fixable) but also I was left with half::_toFloat and half::_eLut as unresolved 
externals - suspiciously the fellas that cause the DLL crash you are talking 
about.

Unfortunately I just have not had time to fully run through and come up with a 
solution so I switched back to static libs in the end :(

Best Regards,
   Simon

On 17 Mar 2014, at 23:34, Gonzalo Garramuño wrote:

> On 17/03/2014 05:45 p.m., Thorsten Kaufmann wrote:
>> I guess it has to do with this warning:
>> 
>> 3>half.obj : warning LNK4197: export '?_toFloat@half@@0QBTuif@1@B' specified 
>> multiple times; using first specification
>> 3>half.obj : warning LNK4197: export '?_eLut@half@@0QBGB' specified multiple 
>> times; using first specification
>> 
>> Though i am unsure how to fix that.
> 
> Also, I tried the lib on a simple program which linked fine but the output 
> was garbage:
> 
> #include <iostream>
> #include <half.h>
> 
> 
> int main()
> {
>   half p = 0.5f;
>   std::cerr << p << std::endl;
> }
> 
> $ cd <mydir>
> $ cl.exe -EHsc -IF:/code/lib/Deploy/include half.cpp -link 
> -libpath:F:/code/lib/Deploy/lib/x64/Release Half.lib
> $ cp F:/code/lib/Deploy/bin/x64/Release Half.dll .
> $ half.exe
> 7.53516
> 
> huh?  On linux this prints out 0.5 as it should.
> 
> 
> 
> _______________________________________________
> Openexr-devel mailing list
> Openexr-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/openexr-devel

_______________________________________________
Openexr-devel mailing list
Openexr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/openexr-devel

Reply via email to