delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/08/01/10:39:05

X-Spam-Check-By: sourceware.org
Message-ID: <44CF677A.3050707@statslab.cam.ac.uk>
Date: Tue, 01 Aug 2006 15:38:50 +0100
From: Ben Wright <B DOT Wright AT statslab DOT cam DOT ac DOT uk>
User-Agent: Mozilla Thunderbird 1.0.8-1.4.1.SL3 (X11/20060421)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Fortran calling c compilation problem
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

I'm working on a project that uses a combination of c++, c and fortran 
to build a library for use with the Java Native Interface. The library 
compiles correctly under Linux with gcc 3.2.3, but I can't get it to 
compile correctly under cygwin (using gcc 3.4.4).

I'm calling:

g++ -mno-cygwin -Wl,--add-stdcall-alias 
-I/cygdrive/c/Java/jdk1.5.0_07/include 
-I/cygdrive/c/Java/jdk1.5.0_07/include/win32 -shared -o Samplers.dll <a 
whole bunch of source files here> -lstdc++ -lg2c

/cygdrive/c/DOCUME~1/ben/LOCALS~1/Temp/ccWWbiIF.o:gengam.f(.text+0x5): 
undefined reference to `_dgamdv_'
(plus others of similar form)

The linker can't seem to find references of the form _dgamdv_. Functions 
are defined in the c portion as gdamdv_(<whatever>), and are called from 
Fortran as DGAMDV(). This works fine under Linux.

What's baffling is that if I compile just the c portion and inspect the 
output with nm then the supposedly undefined references are in there.

10004148 T _dgamdv_

Is there some quirk of cygwin when calling c from within fortran I need 
to set a flag for when compiling? I'd ordinarily chalk it up to my weak 
knowledge of c- but it compiles without complaint under Linux.

Thanks in advance.

-- 
Benjamin Wright
Statistical Laboratory
Centre for Mathematical Sciences
Wilberforce Road
Cambridge
CB3 0WB
(01223) 766 536

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