according to the FAQ minggw is capable of making DLL that are compatible with Visual Studio
http://oldwiki.mingw.org/index.php/sample%20DLL
Moderators: Sascha Willems, walaber
ar rc libfoo.a foo1.o foo2.o foo3.o ...
ranlib libfoo.a
Julio Jerez wrote:I cannot believe that no one have made a Visual Studio Plug in using GCC. That should be quite simple but the Open source people keep with this Draconian Mentality that ever thing have to be retrograde
Marc wrote:Oh I just saw you created a thread on its own for this issue. I never created a dll with mingw before, but I used a precompiled dll by someone else who compiled it in mingw in vc. So I think it has to work unless they changed it to not working anymore over the last 2 years - which I doubt.
I don't know exactly what your problem is, but I tried and here is a simple printhello dll code that compiles with mingw and a vs2008 project that uses the created lib/dll: http://www.transmogrifier.de/temp/mingwvcdll.zip But maybe that wasn't even your problem?
In the dll dir, there is the dll.cpp which implements the actual function. Then there is dll.h for later usage in vc. compile.bat compiles the cpp file with c exports to a dll.dll, dll.def and libdll.a file. Then lib - from vc - creates a dll.lib from the dll.def. App links to dll.lib and needs dll.dll in its working dir, so compile also copies dll.dll in the app dir. (I don't know much about makefiles so I made a .cmd ...) I hope that helps.
One thing I don't know how to solve but maybe irrelevant due to newton's c link interface: exporting classes. Names seem to get mangled differently between compilers in c++, so the method from above only seems to work with the extern c around the exports. They don't work for classes because they are c++.
agi_shi wrote:Julio, this is Microsoft's fault because using MSVC with a different compiler is incredibly hard. Take a look at the open source Code::Blocks, for example - it supports MSVC's compiler as well as GCC and others.
Marc wrote:Here is the link I posted in the other thread about how to create a vc compatible dll with mingw:
http://www.mingw.org/wiki/MSVC_and_MinGW_DLLs
Julio Jerez wrote:So This is possible then. :mrgreen:
I will chek that project out, if someone did it I must be able to do it too.
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
Julio Jerez wrote:But the MinGW library do not have DLLMain function, instead they have this code
Users browsing this forum: No registered users and 5 guests