05-15-2013 09:30 AM - edited 05-15-2013 09:37 AM
A completely new static lib file created in VS2010 Express hat the following content:
StaticLib.h:
void __stdcall call( void );
StaticLib.c
void __stdcall call( void ){ }
VS2010 compiles this as a c file. This is already ensured by the ending ".c", but to be safe I use the compiler option /TC .
All other options are at their default value. I compile using "Release | Win32".
The created lib file is copied to an new CVI folder, along with the header.
Both files are added to the project.
In addition a main.c is created with the following content:
void main ( void ){ call(); }
The compile attempt is aborted with the following error message:
Bad header encountered while reading external module: 'Release\StaticLib.obj'.
Aborted load of member "Release\StaticLib.obj" from library "c:\C90\LibImportTest\Release\LibImportTest.lib".
Is there a way to reuse static lib files compiled in VS2010 with CVI?
If so please show me a minimal example.
( please do not post any suggestions involving dlls )
Solved! Go to Solution.
05-17-2013 09:47 AM
Do you run a 64 bit Operating System?
Best regards,
Adilo
05-21-2013 02:50 AM
Yes, but both projects are compiled as 32 bit.
05-21-2013 09:33 AM
I also posted this on the stackoverflow forum.
I found a possible cause for the problem. Is CVI capable of linking multithread static libraries?
05-22-2013 09:11 AM
I tried this with CVI 2012. I think its the VC 2010 Project Setting: Configuration Properties >> General >> Whole Program Optimization = Use Link Time Code Generation that causes the problem with CVI. Change this setting to "No Whole Program Optimization" and CVI 2012 is able to link the VC 2010 lib file for me. Hope this is the same issue for you. If not, try changing other VC optimization or language settings in the Project Properties dialog..
05-22-2013 09:16 AM - edited 05-22-2013 09:17 AM
Thank you.
I just tried it and it solves the Problem.
If you have a stackoverflow account post there too - i can accept your solution there also.