Hi,

I reopen the thread from 2013/04/24 started by Peshala Pahalawatta (http://lists.nongnu.org/archive/html/openexr-devel/2013-04/msg00062.html) in order to suggest a solution to the problem.

I also had the problem of the failing HalfTest project. I'm using Win7 with VS2010. (I downloaded the VC9 project files from the repository and updated them.) I compiled Half and HalfTest in Debug,Release & Win32,x64. With every test run I got the same error as Peshala, but I found some ways to fix this problem.

1. Don't export the look-up tables.
One suggestion is to remove the inline parameter from "half::half (float f)" and "half::operator float () const" and to move the definition to half.cpp. As a result, you can savely remove the HALF_EXPORT keyword from half::_toFloat and half::_eLut in half.h and half.cpp. Doing this, will most probably affect the performance of the half datatype.

2. Compile Half as static library.
There are some tutorials on the internet how to achieve this. (e.g. http://www.fixstars.com/en/lucille/docs/dev/index.php/How_to_build_OpenEXR_libs_for_Win_64bit) This confirms Peshala's suggestion that the export declarations are messed up.

3. Correct the export definition in halfExport.h.
As Peshala correctly stated, the PLATFORM_WINDOWS keyword is never defined in the VS project files. The other base libraries as IlmThread use another way to define their *EXPORT keyword (,which work flawlessly). I simply adjusted their definition to the half project. As a result you will get this content for halfExport.h (remove every other line of code).

#if defined(OPENEXR_DLL)
    #if defined(HALF_EXPORTS)
        #define HALF_EXPORT __declspec(dllexport)
        #define HALF_EXPORT_CONST extern __declspec(dllexport)
    #else
        #define HALF_EXPORT __declspec(dllimport)
        #define HALF_EXPORT_CONST extern __declspec(dllimport)
    #endif
#else
    #define HALF_EXPORT
    #define HALF_EXPORT_CONST extern const
#endif

Additionally, you should check the VS project files for the correct definition of OPENEXR_DLL (Half and HalfTest) and HALF_EXPORT (only Half).

I prefer the last solution, but I let the maintainer decide which one to choose. (Btw, the Iex project has the same incorrectly used export definition.)

Best regards,
Michael

-----
visit us at

Digital Signage Europe Expo 2013 / June 12-13 / The Station-Gleisdreieck, 
Berlin, Germany / booth F.10

infoCOMM13 / June 12-14 / Orange County Convention Center, Orlando, Florida / 
booth 5453

www.hhi.fraunhofer.de/events
_______________________________________________
Openexr-devel mailing list
Openexr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/openexr-devel

Reply via email to