This is the mail archive of the cygwin 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]

dll to LIB -- then link error

I am working on a problem regarding creating a dll from c source code
of which I have written (JNI routines) along with linking to a
commercial dll that does contain a .def or .a file.  My OS is winXP
and I am using cygwin 2.510.2.2.

The steps I am going through to create the lib:

(1) Use Borland's command line tool impdef to create a definition file.

impdef file1.def file1.dll

(2)   Use cygwin's command line tool, dlltool, to create imprt library
files for each dll that is used.

dlltool --dllname file1.dll --def file1.def --output-lib file1.a

I also tried the command with the -k command.

(3) Placed all of the .a libraries within the cygwin\usr\lib\w32api directory

(4) Attempt to create a dll containing my c code while linking to file1.dll

gcc -mno-cygwin -I"\\cygdrive\\c\\include\\Windows"
-W1,--add-stdcall-alias -shared -o file1.dll source1.c source2.c

"\\cygdrive\\c\\include\\Windows" = contains all of the .h files
describing the commercial dll's that I am including in my C source
"\\cygdrive\\c\\j2sdk1.4.2_13\\include" = contains the jni.h file from
sun "\\cygdrive\\c\\j2sdk1.4.2_13\\include\\win32" = contains the
jni_md.h file from sun "\\cygdrive\\c\\Temp\\cygwin\\usr\\lib\\w32api"
= contains the .a file I created in step 2
"\\cygdrive\\c\\Temp\\cygwin\\home\\user\\dll" = contains the dll's
from the commerical company (file1.dll)

I recieve the following errors:

...source2.c:(.text+0x3):undefined reference to '_function@4'
...source2.c:(.text+0x3e):undefined reference to '_function2@4'
...source2.c:(.text+0x7e):undefined reference to '_function3@8'
...source2.c:(.text+0xc5):undefined reference to '_function4@0'

The .def file looks like:
LIBRARY     file1.dll


I would graciously appreciate any help.

Unsubscribe info:
Problem reports:

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