delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/06/16/13:23:46

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
To: cygwin AT cygwin DOT com
From: Ronald Landheer-Cieslak <ronald AT landheer DOT com>
Subject: Re: JNI loading dlls which link to cygwin1.dll
Date: Wed, 16 Jun 2004 13:07:56 -0400
Lines: 125
Message-ID: <capupc$jhj$1@sea.gmane.org>
References: <20040616122319 DOT 28230 DOT qmail AT web50103 DOT mail DOT yahoo DOT com>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: dslcom1-156.express.oricom.ca
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7) Gecko/20040608
In-Reply-To: <20040616122319.28230.qmail@web50103.mail.yahoo.com>
Reply-To: cygwin AT cygwin DOT com

Have a look at the thread that starts here:
http://sources.redhat.com/ml/cygwin/2003-03/msg00795.html

If that doesn't help you, please report back :)

(In short, that thread lead to the conclusion that there was a problem 
with the calling convention used. Your linker flag to add stdcall 
versions of the functions is not too far off the final result).

HTH

rlc

Andrew Hinton wrote:

> I have been attempting to port a large program from
> Linux to Windows using Cygwin.  The program is written
> in Java, C and C++; using the JNI to link them
> together.
> 
> I have successfully compiled and linked all of the C
> and C++ code using Cygwin, and successfully executed a
> test program written in C++. 
> 
> The following illustrates the compiler flags I was
> using:
> 
> g++ -c -D__int64="long long" ###includes### *.cc
> gcc -Wl,--add-stdcall -shared -o ~/prism/lib/file.dll
> *.o -L ~/prism/lib -lutil -lepd
> 
> The problem comes when the JNI tries to load the
> shared dlls in the loadLibrary() method.  The JNI
> appears to be able to find the libraries, as no
> UnsatisfiedLinkError is reported; however, the
> execution halts, giving no output.  
> 
> It appears that JNI has problems with cygwin1.dll,
> because I have had no JNI problems with dlls not
> created using Cygwin.
> 
> After searching the Internet and this mailing list,
> most sources seem to point out that I should use the
> -mno-cygwin compiler flag.  This appears to remove the
> need for the cygwin1.dll at runtime.  However, this
> results in compile errors.  For example:
> 
> $ gcc -c -D__int64="long long" -I../mnemosyne/ *.c
> 
> This works fine … but this doesn’t:
> 
> $ gcc -mno-cygwin -c -D__int64="long long"
> -I../mnemosyne/ *.c
> datalimit.c:17:26: sys/resource.h: No such file or
> directory
> pipefork.c:12:22: sys/wait.h: No such file or
> directory
> test-res.c:5: error: syntax error before '(' token
> test-res.c:9: error: syntax error before '{' token
> test-res.c:13: error: conflicting types for `prog'
> test-res.c:11: error: previous declaration of `prog'
> test-res.c:13: warning: data definition has no type or
> storage class
> test-res.c:14: error: syntax error before "if"
> test-res.c:16: error: syntax error before numeric
> constant
> test-res.c:16: error: conflicting types for `exit'
> /usr/i686-pc-mingw32/include/stdlib.h:357: error:
> previous declaration of `exit'
> test-res.c:16: warning: data definition has no type or
> storage class
> test-res.c:18: error: syntax error before string
> constant
> test-res.c:18: error: conflicting types for
> `util_restart'
> util.h:240: error: previous declaration of
> `util_restart'
> test-res.c:18: warning: data definition has no type or
> storage class
> test-res.c:20: error: initializer element is not
> constant
> test-res.c:20: warning: data definition has no type or
> storage class
> test-res.c:21: error: syntax error before "void"
> test-res.c:25: error: syntax error before '!=' token
> test-res.c:30: error: redefinition of `i'
> test-res.c:20: error: `i' previously defined here
> test-res.c:30: warning: data definition has no type or
> storage class
> test-res.c:31: error: syntax error before "for"
> test-res.c:31: error: syntax error before '!=' token
> 
> 
> 
> The problem seems to be that a lot of the program uses
> routines that (I think) are not part of the windows
> API, specifically the following headers are used:
> 
> sys/files.h
> sys/file.h
> stream.h
> unisd.h
> sys/time.h
> sys/resource.h
> sys/times.h
> types.h
> times.h
> sys/wait.h
> a.out.h
> pwd.h
> 
> I have searched the Internet, the Cygwin manual and
> Cygwin’s FAQ and I have found nothing that explains
> the problem with JNI and cygwin1.dll.  Could anyone
> either point me in the right direction or say whether
> I am doing anything wrong.  Or does anyone know if
> there is a way to make this work without the need for
> the cygwin1.dll?
> 
> I have attached the cygcheck file.
> 
> Thanks,
> 
> Andrew Hinton
> 


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