public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* linking against dlls
@ 2001-08-24  6:55 bumps man
  2001-08-24  9:24 ` Charles S. Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: bumps man @ 2001-08-24  6:55 UTC (permalink / raw)
  To: cygwin

I apologize if this problem is covered in the documentation.  I
haven't been able to find an answer, in docs or in newsgroups.

The "Linking Against DLLs" section of the user manual describes a
method which "will only work if the DLL is not stripped. Otherwise you
will get an error message: 'No symbols in foo.dll'"

I wish to link to a DLL which is apparently stripped, since I recieve
this error message.

The documentation does not say whether this is possible or not; maybe
the implication is that it is not possible, I don't know.

Since Visual C++ is able to link against a stripped DLL, my second
more general question is whether cygwin/gcc can
do everything MSVC++ can do.

Thanks in advance.



-- 

Get your free email from www.linuxmail.org 


Powered by Outblaze

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linking against dlls
  2001-08-24  6:55 linking against dlls bumps man
@ 2001-08-24  9:24 ` Charles S. Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Charles S. Wilson @ 2001-08-24  9:24 UTC (permalink / raw)
  To: bumps man; +Cc: cygwin

bumps man wrote:

> I apologize if this problem is covered in the documentation.  I
> haven't been able to find an answer, in docs or in newsgroups.
> 
> The "Linking Against DLLs" section of the user manual describes a
> method which "will only work if the DLL is not stripped. Otherwise you
> will get an error message: 'No symbols in foo.dll'"
> 
> I wish to link to a DLL which is apparently stripped, since I recieve
> this error message.
> 
> The documentation does not say whether this is possible or not; maybe
> the implication is that it is not possible, I don't know.


Not directly.  You can create an implib for the dll, and then link 
against the implib.  Use pexports to create a .def file for the dll, 
then use dlltool to generate an implib from the .def+.dll.  pexports is 
available from http://infoservice.lg.ua/~paul/devel/binutils.html . 
Dlltool is part of binutils.

Obviously, I haven't done all your work for you -- you're going to have 
to read the manuals to figure out how to do the above tasks...


> 
> Since Visual C++ is able to link against a stripped DLL, my second
> more general question is whether cygwin/gcc can
> do everything MSVC++ can do.


Doesn't MSVC ship .lib files (VC-style import libs) for the system 
.dll's and ACTUALLY links against those?)  I'm not convinced that MSVC 
*can* link directly to a stripped dll (or even an unstripped dll, for 
that matter) without using an import lib.  gcc's ability to link 
directly to a dll (unstripped) without using an implib was fairly 
innovative, I thought...

--Chuck


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* linking against DLLs
@ 1999-01-31 23:52 James Scott
  1999-01-31 23:52 ` bowman
  0 siblings, 1 reply; 5+ messages in thread
From: James Scott @ 1999-01-31 23:52 UTC (permalink / raw)
  To: gnu-win32

Hi, 

I'm having trouble linking against a DLL after following the instructions
in the user guide
( http://sourceware.cygnus.com/cygwin/cygwin-ug-net/dll-link.html ).

First off, nm claims that the DLL has no symbols. If I carry on through
the process generating the .a file, I get unresolved symbols. 

Also I do have the .LIB files used for VC and the .LNK files used by
Watcom. Is there any way I can use them instead. 


thanks, 

James Scott

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linking against DLLs
  1999-01-31 23:52 linking against DLLs James Scott
@ 1999-01-31 23:52 ` bowman
  1999-01-31 23:52   ` James Scott
  0 siblings, 1 reply; 5+ messages in thread
From: bowman @ 1999-01-31 23:52 UTC (permalink / raw)
  To: James Scott, gnu-win32

James Scott wrote:
> 
> Hi,
> 
> I'm having trouble linking against a DLL after following the instructions
> in the user guide

for MS dll's, you can use 'impdef' do get a list of the entries. Note
that these do not have a '@xx' suffix, where 'xx' is the size of the
parameters on the stack. You can edit this file against the header. The
rule of thumb seems to be, 4 bytes per parameter, so Foo() would be  
Foo@0,  Foo(int, int, char*) Foo@12, etc. I think Anders Norlander has a
tool for this fixup on the def files, but I haven't used it.

Then you can say,

dlltool -D foo.dll -d foo.def -llibfoo.a -k

NB: the '-k' kills the export of the decorated name. Gcc needs to see
the *@xx form, while the dll must be called with the undecorated name.

afaik, the instructions on the web site are for linking against a dll
created by gcc, not a MS dll. The above seems to work for me, but if
there is an easier or more correct procedure, I'd like to see it.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linking against DLLs
  1999-01-31 23:52 ` bowman
@ 1999-01-31 23:52   ` James Scott
  0 siblings, 0 replies; 5+ messages in thread
From: James Scott @ 1999-01-31 23:52 UTC (permalink / raw)
  To: bowman; +Cc: gnu-win32

Thanks, 

I also found out DUMPBIN.EXE from VC5 can be used generate .def files,
e.g.:

DUMPBIN /exports foo.dll |
awk '/@/{print $3}' |
awk 'BEGIN { FS = "@"; printf("EXPORTS\n"); }
     /@/{printf("%s @%s\n", $1,$2);}' > foo.def

and I found out after ages of frustration that you've got to have a space
between the symbol name and the @ sign!

James

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-08-24  9:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-24  6:55 linking against dlls bumps man
2001-08-24  9:24 ` Charles S. Wilson
  -- strict thread matches above, loose matches on Subject: below --
1999-01-31 23:52 linking against DLLs James Scott
1999-01-31 23:52 ` bowman
1999-01-31 23:52   ` James Scott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).