How to create a relocatable dll with mingw

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How to create a relocatable dll with mingw

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

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

This did not help us either.

Would appreciate any suggestions that helps resolve this issue.

Thanks,
Vasu


------------------------------------------------------------------------------
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Earnie Boyd
On Wed, Apr 18, 2012 at 8:56 PM, Srinivas Cherukumilli <[hidden email]> 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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Srinivas Cherukumilli

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 <[hidden email]> wrote:

> From: Earnie Boyd <[hidden email]>
> Subject: Re: [Mingw-users] How to create a relocatable dll with mingw
> To: "MinGW Users List" <[hidden email]>
> Date: Thursday, April 19, 2012, 5:27 AM
> On Wed, Apr 18, 2012 at 8:56 PM,
> Srinivas Cherukumilli <[hidden email]>
> 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
> [hidden email]
>
> 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:[hidden email]?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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Earnie Boyd
Do not top post.

On Thu, Apr 19, 2012 at 1:45 PM, Srinivas Cherukumilli <[hidden email]> wrote:
>
> 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
>

Sorry it should be -Wl,--out-implib,libtest1.dll.a since it is a linker option.

--
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Srinivas Cherukumilli


--- On Thu, 4/19/12, Earnie Boyd <[hidden email]> wrote:

> From: Earnie Boyd <[hidden email]>
> Subject: Re: [Mingw-users] How to create a relocatable dll with mingw
> To: "MinGW Users List" <[hidden email]>
> Date: Thursday, April 19, 2012, 11:00 AM
> Do not top post.
>
> On Thu, Apr 19, 2012 at 1:45 PM, Srinivas Cherukumilli
> <[hidden email]>
> wrote:
> >
> > 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
> >
>
> Sorry it should be -Wl,--out-implib,libtest1.dll.a since it
> is a linker option.

Thanks again Earnie.
Sorry about top posting. Not used to sending mails to forums.
I still have issues with using the -Wl,relocatable and -shared options together.

So, for the two commands you suggested:
(1) gcc -shared -o bar.dll bar.o -Wl,--out-implib,libbar.dll.a
(2) gcc -Wl,-relocatable -shared -o bar.dll bar.o -Wl,--out-implib,libbar.dll.a

Step (1) works.  Get linker errors for step (2). I hope I got all the options right in step (2).

Vasu

>
> --
> 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
> [hidden email]
>
> 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:[hidden email]?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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

John Brown




On  Date: Thu, 19 Apr 2012 11:32:54 -0700, Vasu wrote:

>
> So, for the two commands you suggested:
> (1) gcc -shared -o bar.dll bar.o -Wl,--out-implib,libbar.dll.a
> (2) gcc -Wl,-relocatable -shared -o bar.dll bar.o -Wl,--out-implib,libbar.dll.a
>
> Step (1) works. Get linker errors for step (2). I hope I got all the options right in step (2).
>
> Vasu


Hello Vasu,
You did not post your linker errors, but if your library calls functions in otherlibraries, then you need to include those libraries in your command line, for example  (not tested):
gcc -Wl,-relocatable -shared -o bar.dll bar.o -Wl,--out-implib,libbar.dll.a -lOtherLib1 -lOtherLib2
Regards,John Brown.
     
------------------------------------------------------------------------------
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Srinivas Cherukumilli


--- On Thu, 4/19/12, John Brown <[hidden email]> wrote:

> From: John Brown <[hidden email]>
> Subject: Re: [Mingw-users] How to create a relocatable dll with mingw
> To: [hidden email]
> Date: Thursday, April 19, 2012, 2:08 PM
>
>
>
>
> On  Date: Thu, 19 Apr 2012 11:32:54 -0700, Vasu wrote:
>
> >
> > So, for the two commands you suggested:
> > (1) gcc -shared -o bar.dll bar.o
> -Wl,--out-implib,libbar.dll.a
> > (2) gcc -Wl,-relocatable -shared -o bar.dll bar.o
> -Wl,--out-implib,libbar.dll.a
> >
> > Step (1) works. Get linker errors for step (2). I hope
> I got all the options right in step (2).
> >
> > Vasu
>
>
> Hello Vasu,
> You did not post your linker errors, but if your library
> calls functions in otherlibraries, then you need to include
> those libraries in your command line, for example  (not
> tested):
> gcc -Wl,-relocatable -shared -o bar.dll bar.o
> -Wl,--out-implib,libbar.dll.a -lOtherLib1 -lOtherLib2
> Regards,John Brown.

Hi John,

The linker complains about using -relocatable and -shared together.
I have pasted the errors below.

gcc -Wl,--relocatable -shared -o test1.dll test1.o  -Wl,--out-implib,libtest1.dll.a
.../bin/../libexec/gcc/mingw32/4..1/ld.exe: -r and -shared may not be used together
collect2: ld returned 1 exit status

Thanks for your help.
Vasu

>     
>         
>           
>  
> ------------------------------------------------------------------------------
> 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
> [hidden email]
>
> 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:[hidden email]?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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Ross Ridge
In reply to this post by Srinivas Cherukumilli
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

John Brown
In reply to this post by Srinivas Cherukumilli

On Thu, 19 Apr 2012 14:30:20 -0700, Srinivas Cherukumilli wrote:

> >
> >
> > Hello Vasu,
> > You did not post your linker errors, but if your library
> > calls functions in otherlibraries, then you need to include
> > those libraries in your command line, for example (not
> > tested):
> > gcc -Wl,-relocatable -shared -o bar.dll bar.o
> > -Wl,--out-implib,libbar.dll.a -lOtherLib1 -lOtherLib2
> > Regards,John Brown.
>
> Hi John,
>
> The linker complains about using -relocatable and -shared together.
> I have pasted the errors below.
>
> gcc -Wl,--relocatable -shared -o test1.dll test1.o -Wl,--out-implib,libtest1.dll.a
> .../bin/../libexec/gcc/mingw32/4..1/ld.exe: -r and -shared may not be used together
> collect2: ld returned 1 exit status
>
> Thanks for your help.
> Vasu


 

Hello Vasu,

 

I see where you *did* post your error message earlier. Sorry about that.

Unfortunately, I do not have the answer.

 

Regards,

John Brown.    
------------------------------------------------------------------------------
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Earnie Boyd
In reply to this post by Srinivas Cherukumilli
On Thu, Apr 19, 2012 at 2:32 PM, Srinivas Cherukumilli <[hidden email]> wrote:

>
>
> --- On Thu, 4/19/12, Earnie Boyd <[hidden email]> wrote:
>
>> From: Earnie Boyd <[hidden email]>
>> Subject: Re: [Mingw-users] How to create a relocatable dll with mingw
>> To: "MinGW Users List" <[hidden email]>
>> Date: Thursday, April 19, 2012, 11:00 AM
>> Do not top post.
>>
>> On Thu, Apr 19, 2012 at 1:45 PM, Srinivas Cherukumilli
>> <[hidden email]>
>> wrote:
>> >
>> > 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
>> >
>>
>> Sorry it should be -Wl,--out-implib,libtest1.dll.a since it
>> is a linker option.
>
> Thanks again Earnie.
> Sorry about top posting. Not used to sending mails to forums.
> I still have issues with using the -Wl,relocatable and -shared options together.
>
> So, for the two commands you suggested:
> (1) gcc -shared -o bar.dll bar.o -Wl,--out-implib,libbar.dll.a
> (2) gcc -Wl,-relocatable -shared -o bar.dll bar.o -Wl,--out-implib,libbar.dll.a
>
> Step (1) works.  Get linker errors for step (2). I hope I got all the options right in step (2).
>

Oh, sorry for the confusion. (///)  --relocatable isn't usable with
-shared.  You can use --embedded-relocs with -shared though.

--
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
[hidden email]

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:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: How to create a relocatable dll with mingw

Srinivas Cherukumilli
In reply to this post by Srinivas Cherukumilli
--- On Fri, 4/20/12, Earnie Boyd <[hidden email]> wrote:

> From: Earnie Boyd <[hidden email]>
> Subject: Re: [Mingw-users] How to create a relocatable dll with mingw
> To: "MinGW Users List" <[hidden email]>
> Date: Friday, April 20, 2012, 5:16 AM
> On Thu, Apr 19, 2012 at 2:32 PM,
> Srinivas Cherukumilli <[hidden email]>
> wrote:
> >
> >
> > --- On Thu, 4/19/12, Earnie Boyd <[hidden email]>
> wrote:
> >
> >> From: Earnie Boyd <[hidden email]>
> >> Subject: Re: [Mingw-users] How to create a
> relocatable dll with mingw
> >> To: "MinGW Users List" <[hidden email]>
> >> Date: Thursday, April 19, 2012, 11:00 AM
> >> Do not top post.
> >>
> >> On Thu, Apr 19, 2012 at 1:45 PM, Srinivas
> Cherukumilli
> >> <[hidden email]>
> >> wrote:
> >> >
> >> > 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
> >> >
> >>
> >> Sorry it should be -Wl,--out-implib,libtest1.dll.a
> since it
> >> is a linker option.
> >
> > Thanks again Earnie.
> > Sorry about top posting. Not used to sending mails to
> forums.
> > I still have issues with using the -Wl,relocatable and
> -shared options together.
> >
> > So, for the two commands you suggested:
> > (1) gcc -shared -o bar.dll bar.o
> -Wl,--out-implib,libbar.dll.a
> > (2) gcc -Wl,-relocatable -shared -o bar.dll bar.o
> -Wl,--out-implib,libbar.dll.a
> >
> > Step (1) works.  Get linker errors for step (2). I
> hope I got all the options right in step (2).
> >
>
> Oh, sorry for the confusion. (///)  --relocatable isn't
> usable with
> -shared.  You can use --embedded-relocs with -shared
> though.
>
Thanks Earnie,

This switch did not help either. I have attached a small test case where the program that loads up the dll's is compiled with Visual Studio 9.0 and the dll's are compiled using gcc-4.2.1-mingw32 and this has the MSVCR90.

I have left my executables etc. as-is in the attached tar file. One person on this mailing list already tried building and running this with gcc-4.5.x and seemed to work for him.

Would appreciate if anyone else could try and suggest a workaround/solution to this issue as upgrading to a newer gcc is not a viable option for us. I can attach my version of the mingw compiler as well if needed.

Thanks & Regards,
Vasu

> --
> 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
> [hidden email]
>
> 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:[hidden email]?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
[hidden email]

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:[hidden email]?subject=unsubscribe

testcase.tar.gz (53K) Download Attachment