This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: building DLLs (was:RE: New user help - dont understand Mount (and the rest))


Kevin Wright writes:
 > Markus,
 > 
 > I believe I derived that example from Charles Wilson, so he would have more
 > expertise in this area. However, I can say from my own experience that I
 > always have to use a two step process:
 > 
 > Here's an example from my notes when I built libiconv:
 > 
 > a) create the .def file using dlltool
 >    (this creates a libfoo.dll.a which can be linked against.)
 >    $ dlltool --export-all --output-def libiconv_.def --dllname libiconv.dll
 > *.o
 >    NOTE: be careful which .o files are used for this. You don't always want
 >    to export all of the symbols otherwise you'll have problems creating the
 > dll.
 >    A good rule of thumb is to use the same objects that would normally be
 >    used to create the static library.
 > 

This looks good in my case. I get a .def file with a huge amount of
exports (this is expected).


 > b) create the dll using gcc -shared
 >    $ gcc -shared -Wl,--enable-auto-image-base -o libiconv.dll \
 >      -Wl,--out-implib=libiconv.dll.a libiconv_.def *.o
 > 

If I try this, ld exits with a segfault.

 >[...]
 > 
 >    gcc -Wl,--out-implib,libtest.import.a -shared -o test.dll test.o
 > 

This is similar to what I tried before, but I still get:
Cannot export _bss_end__: symbol not defined
Cannot export _bss_start__: symbol not defined
Cannot export _data_end__: symbol not defined
Cannot export _data_start__: symbol not defined
Creating library file: libosp.dll.a
collect2: ld returned 1 exit status

Unfortunately I lack a basic understanding of DLLs. What do these
messages mean to me? Am I supposed to provide definitions for those
symbols or am I supposed to remove some definitions that make the
symbols show up in the exports?

I'd like to add that the DLL-to-be that I'm fiddling with
(libosp.dll/OpenSP) builds on Win32/MSVC and Linux etc, so I assume
that the code is prepared for building a DLL. The __declspec() magic
is included via #define.

Thanks anyway Kevin for the explicit instructions.

regards,
Markus

-- 
Markus Hoenicka, PhD
UT Houston Medical School
Dept. of Integrative Biology and Pharmacology
6431 Fannin MSB4.114
Houston, TX 77030
(713) 500-6313, -7477
(713) 500-7444 (fax)
Markus.Hoenicka@uth.tmc.edu
http://ourworld.compuserve.com/homepages/hoenicka_markus/


--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]