« Return to Thread: How to create a relocatable dll with mingw

Re: How to create a relocatable dll with mingw

by Ross Ridge :: Rate this Message:

| View in Thread

Srinivas Cherukumilli writes:
>We are running into issues trying to load dll's into a program that has
>been compiled with Visual Studio. We invariably get the "Invalid access
>to memory location" error while trying to load the dll. It appears that
>the dll created using mingw gcc-4.2.1 is not relocatable.

It's unlikely that the DLL isn't relocatable.  DLLs are relocatable by
default, and you would actually have to try to create a DLL that wasn't.

What does running "objdump -f foo.dll" on this problem DLL say?  It should
look something like:

        mymcsup.dll:     file format pei-i386
        architecture: i386, flags 0x0000013b:
        HAS_RELOC, EXEC_P, HAS_DEBUG, HAS_SYMS, HAS_LOCALS, D_PAGED
        start address 0x660010c0

If it says "HAS_RELOC" then its relocatable.  If doesn't and it gives
a start address of 0x004xxxxx then you've probably accidentally created
an executable instead of a DLL.

The correct way to create a DLL is like in Earnie Boyd's first
example. The --relocatable (-r) linker option tell the linker to create
an object (.o) file instead of a executable or DLL.

                                                Ross Ridge


------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
MinGW-users mailing list
MinGW-users@...

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@...?subject=unsubscribe

 « Return to Thread: How to create a relocatable dll with mingw