views:

1148

answers:

2

Update: I get this warning when compiling: multiple '.text' sections found with different attributes

Hi,

I've compiled some libraries (.a and .dll) in Linux using the MinGW Cross Compiler. I can successfully link against them (.a) in Visual Studio 2008. However, when it runs (using .dll), it terminates with the address pointer pointing at empty memory addresses.

Is there a way/a list of things to do that will allow me to use those libraries successfully in VC08?

The cross compiler generates

  1. *.dll.a
  2. *.dll

Thanks

+1  A: 

It sounds to me like the two parties are not using the same calling convention, meaning there is a problem in the way the exported dll functions have been defined.

By far the simplest approach would be to define the functions as extern "C" by defining the exported functions as follows:

extern "C"
{
  int  MyExportedFunction(char *buffer, int length);
  void MyOtherFunction();
};
jussij
I had extern "C" in the header import.
jameszhao00
I just noticed. I get multiple '.text' sections found with different attributeswhen compiling.
jameszhao00
+2  A: 

Found it.

http://www.mingw.org/wiki/MSVC%5Fand%5FMinGW%5FDLLs

You have to have a def file and use the VC's lib tool to generate an import library.

jameszhao00