Fortran calling c compilation problem

Ben Wright B.Wright@statslab.cam.ac.uk
Tue Aug 1 14:38:00 GMT 2006


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/



More information about the Cygwin mailing list