This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

re: little help with dll


hi-

first... thanks Gerrit for the help.  i think i am
making more progress.  i never built my own dll as an
export library.  it is fun to try.

i have a question about this code below.  the way i
have it set up is fox.dll is the name of the dll i
want to create.  fox.dll.a is (good question) i guess
it is a output product of the process.  then i supply
my object files.  then i supply the name of the import
libs i need to link against.  

here is a question.  do i have to supply all 19 of
these import libs that end with *.a in my
cygwin/lib/mingw directory?  i know there can be tons
of these *.a and 19 is not very many but that is lots
of typing.  is there a way i can not specify the path
and then import lib name for every one of the 19.  for
i.e. could i somehow skip the path and just list each
one with some mystery setting or make it so it looks
automatically at the directory and takes all the *.a
files.  

-my settings for the last step required to build
dll------------------------------------------------------

c++ -shared -o fox.dll \
    -Wl,--out-implib=fox.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--whole-archive /cygwin/fox.o
/cygwin/fox_wrap.o  \
    -Wl,--no-whole-archive 
/cygwin/lib/mingw/libmingw32.a

-----------------------------------------------

thanks for any help you can provide
marvin

for completeness, i am snipping a little bit of the
manual and a response to help clarify things.



-----an explanation from the manual-------------------

However, if you are building a dll as an export
library, you will probably want to use the complete
syntax:

gcc -shared -o cyg${module}.dll \
    -Wl,--out-implib=lib${module}.dll.a \
    -Wl,--export-all-symbols \
    -Wl,--enable-auto-import \
    -Wl,--whole-archive ${old_lib} \
    -Wl,--no-whole-archive ${dependency_libs}
 

Where ${module} is the name of your DLL, ${old_lib}
are all your object files, bundled together in static
libs or single object files and the ${dependency_libs}
are import libs you need to link against, e.g '-lpng
-lz -L/usr/local/special -lmyspeciallib'.

----------------------------------------------

----more and different explanation----------------
gcc -shared -o cyg${NAME}.dll
-Wl,--out-implib=lib${NAME}.dll.a \
 -Wl,--export-all-symbols -Wl,--enable-auto-import
-Wl,--whole-archive
 ${OBJECTS} -Wl,--no-whole-archive ${LIBSPATH} ${LIBS}

You'll get an importlibrary which is stored in the
$LIBPATH and a DLL
which is used at runtime and needs to be somewhere in
the $PATH.
--------------------------------------
KEYWORDS
$SRCS: C/C++ sources
$OBJS: compiled .o files
$LIBPATH: Path to language library, e.g.
-L/usr/lib/python2.2/config. Use the path to the .a
file in preference to the .dll file.
$LIBS: Language library, e.g. -lpython2.2












__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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