Location: University of Manchester
Registered: January 2008
Re: compiling libsbml with MinGW
30 Apr '08 12:36
Here are the errors:
List.cpp:335: error: function `List_t* List_create()' definition is marked dllimport.
List.cpp:346: error: function `ListNode_t* ListNode_create(void*)' definition is marked dllimport.
List.cpp:479: error: function `void* List_remove(List_t*, unsigned int)' definition is marked dllimport.
List.cpp:490: error: function `unsigned int List_size(const List_t*)' definition is marked dllimport.
List.cpp: In member function `List* List::findIf(int (*)(const void*)) const':
List.cpp:30: warning: non-inline function 'List::List()' is defined after prior declaration as dllimport: attribute ignored
List.cpp:72: warning: non-inline function 'void List::add(void*)' is defined after prior declaration as dll
I did solve the issue, but not with a configure option.
The configure script picks up mingw but there is no case for mingw in the $host_os case list.
As a quick fudge, I directly edited the extern.h and XMLExtern.h files and found that if I define out the dllimport/dllexport then it compiles through nicely with expat. In export.h and XMLExport.h we have:
#if ( WIN32 && ! defined CYGWIN )
Which does not distinguish MinGW and MSVC. This also results in ignore warnings from gcc about MSVC #pragmas (harmless but avoidable).
That said, dllimport should be possible with mingw. It could be the version I am using (MinGW 5.1.3 with gcc 3.4.5). Different versions of gcc handle dllimports in different ways, and there are some issues out there, particularly when using dllimport for classes (which libsbml does).
I think that it advisable to have a configure option for disabling shared libraries, (like the --disable-shared provided by libtool). It might also be worth considering auto-import with gcc compilers...