On Fri, Jun 16, 2006 at 04:52:27PM +0100, Angus Leeming wrote:

> Abdel> That's what I thought also but Angus
> Abdel> explained me that gcc C++ ABI is 
> Abdel> compatible with microsoft if you use static
> Abdel> linking. It's Gcc dll handling that is non
> Abdel> compatible with MSVC.
> 
> Did I really say that? I have absolutely no evidence
> one way or the other to back that up. What I do
> understand to be true is that .dlls compiled by gcc
> (note, gcc, not g++) should be able to be read by MSVC
> compiled code but can't because they mess up the entry
> point to the .dll.
> 
> (As I understand it, that's the rdata fix that Enrico
> has posted and which I also understand is in the scons
> files.)

I think that is an unrelated problem. I don't have MSVC anymore, but
I remember that I could read a .dll compiled by gcc in MSVC generated
code. Just found a test I performed. I was able to do something like
the following:

-------- testdll.c ---------
/* Compile with gcc -o testdll.dll -mno-cygwin -mthreads -mdll testdll.c */
#include <Windows.h>
__declspec(dllexport) void MyFunc(void)
{
    /* do something here */
}
----------------------------

--------- runtest.c ----------
/* Compile with cl -o runtest.exe runtest.c */
#include <Windows.h>
#include <stddef.h>
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance,
                   LPSTR lpCmdLine, int nCmdShow)
{
    FARPROC myfunc;
    HMODULE lib = LoadLibrary("testdll.dll");
    if (lib != NULL) {
        myfunc = GetProcAddress(lib, "MyFunc");
        if (myfunc != NULL) {
            (*((void(*)())myfunc))();
        }
        FreeLibrary(lib);
    }
    return 0;
}
------------------------------

-- 
Enrico

Reply via email to