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

Re: How to create a relocatable dll with mingw

by Srinivas Cherukumilli :: Rate this Message:

| View in Thread


Thanks for the response Earnie,

But, unfortunatley it does not work.

gcc complains about the missing '.a'
$ gcc -shared -o test1.dll test1.o --out-implib libtest1.dll.a
gcc.exe: libtest1.dll.a: No such file or directory

If I ignore the .a and try to create the dll by passing -relocatable to the linker directly. The linker complains that -shared and -r cannot be used together.

$ gcc -shared -o test1.dll test1.o -Wl,--relocatable
ld.exe: -r and -shared may not be used together
collect2: ld returned 1 exit status

Vasu

--- On Thu, 4/19/12, Earnie Boyd <earnie@...> wrote:

> From: Earnie Boyd <earnie@...>
> Subject: Re: [Mingw-users] How to create a relocatable dll with mingw
> To: "MinGW Users List" <mingw-users@...>
> Date: Thursday, April 19, 2012, 5:27 AM
> On Wed, Apr 18, 2012 at 8:56 PM,
> Srinivas Cherukumilli <vasu_c@...>
> wrote:
> > Hi,
> >
> > 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. btw, we
> are using MSVCR90 and not MSVCRT and this shows up on
> Windows XP but not Windows 7.
> >
> > Followed the instructions mentioned from this article:
> > http://mirrors.zoreil.com/webclub.kcom.ne.jp/ma/colinp/win32/dll/make.html
> >
>
> Based on colinp in the URL I'm guessing this is old stuff.
>
> > gcc -mdll -o junk.tmp -Wl,--base-file,base.tmp bar.o
> > del junk.tmp
> > dlltool --dllname bar.dll --base-file base.tmp
> --output-exp temp.exp --def
> > bar.def
> > del base.tmp
> > gcc -mdll -o bar.dll bar.o -Wl,temp.exp
> > del temp.exp
> >
>
> You can simply use
>
> gcc -shared -o bar.dll bar.o --out-implib libbar.dll.a
> gcc -Wl,--relocatable -shared -o bar.dll bar.o --out-implib
> libbar.dll.a
>
> > This did not help us either.
> >
>
> Hopefully the above should.
>
> > Would appreciate any suggestions that helps resolve
> this issue.
> >
>
> Let us know if we helped.
>
> --
> Earnie
> -- https://sites.google.com/site/earnieboyd
>
> ------------------------------------------------------------------------------
> 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
>

------------------------------------------------------------------------------
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