This is the mail archive of the mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Relocatable DLLs writes:
> I searched for this but couldn't find anything on it.
> When I try to link my dll that has a function that uses iostream (I'm linking
> -lstdc++ with it) I get a bunch of undefined references like "undefined
> refernece to isspace".  I don't know what I'm doing wrong...heres the ld
> command
> ld -s --base-file foo.base --dll -o foo.dll foo.o -lstdc++ -e _dllEntry@12
> Can anyone help?

First of all, I suggest looking at the README file and the examples that
come with dllhelpers package. It would've answered your question right
away. See for more

If you insist on using "ld" to link, then you must know all the other
libraries that are needed, as well as other options that language drivers,
such as gcc and c++, pass on to ld. In this particular case, you're
missing -lcygwin.

I suggest you use c++ to do the job. To make your life easier, just use
dllwrap and be done with it.

  $ dllwrap -o foo.dll --driver-name=c++ --entry _dllEntry@12 foo.o


  $ dllwrap -o foo.dll --entry _dllEntry@12 foo.o -lstdc++

Will build a relocatable DLL (ie., run all 5 passes) for you. Since you're
not specifying a DEF file, I'm assuming that you've used dllexport
attribute in all places necessary. For C++ code, you almost always have to
use --export-all to export everything needed (some are due to bugs and
misfeatures in GCC's dllexport attribute).

  $ dllwrap -o foo.dll --export-all --implib=libfoo.a \
    --entry _dllEntry@12 foo.o -lstdc++


Want to unsubscribe from this list?
Send a message to