delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/03/15:48:42

X-Spam-Check-By: sourceware.org
Message-ID: <704018110701031248i5c6f1742t6eb6b5c0285d3255@mail.gmail.com>
Date: Wed, 3 Jan 2007 15:48:13 -0500
From: "Aaron Baughman" <aaron DOT baughman AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: dll to LIB -- then link error
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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"
-I"\\cygdrive\\c\\j2sdk1.4.2_13\\include"
-I"\\cygdrive\\c\\j2sdk1.4.2_13\\include\\win32"
-I"\\cygdrive\\c\\Temp\\cygwin\\usr\\lib\\w32api"
-I"\\cygdrive\\c\\Temp\\cygwin\\home\\user\\dll"
-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 AT 4'
...source2.c:(.text+0x3e):undefined reference to '_function2 AT 4'
...source2.c:(.text+0x7e):undefined reference to '_function3 AT 8'
...source2.c:(.text+0xc5):undefined reference to '_function4 AT 0'

The .def file looks like:
LIBRARY     file1.dll

EXPORTS
     function AT 1
     function2 AT 2
     function3 AT 3
     function4 AT 4

I would graciously appreciate any help.
Regards,
Aaron.

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019