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.baughman@gmail.com>
To: cygwin@cygwin.com
Subject: dll to LIB -- then link error
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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@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

EXPORTS
     function@1
     function2@2
     function3@3
     function4@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/

