[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: linking fortran subs

From: Phil Cummins
Subject: re: linking fortran subs
Date: Fri, 25 May 2001 15:10:15 +0900

> I think that when you pass character arrays, Fortran has a "hidden"
> argument containing the length of the string.  I don't have the

Thanks A. Scottedward Hodel. I perhaps should have been more 
clear and pointed out that my C->fortran calls include that
extra argument for the character array. 
  I have done a little more study and found that F77_FCN is
basically a macro(?) that takes care of underscoring, etc.
in a portable way. So I shouldn't need it, but my code will
be more portable if I use it. Is that correct?
  My understanding is that the correct way to call a fortran
subroutine from a C++ program is (at least on Linux with
gcc) is:

function prototype:
  extern "C" void assign_(int *, int *, char *, int);

function call:
                                     ^ (extra string length arg)

I just can't figure out why this would generate the errors:

error: /home/cummins/src/seis/ttimes/octtst.oct: undefined symbol: s_rsue:
/home/cummins/src/seis/ttimes/octtst.oct `FSocttst__Fv'
error: /home/cummins/src/seis/ttimes/octtst.oct: undefined symbol: s_rsue:
/home/cummins/src/seis/ttimes/octtst.oct `_FSocttst__Fv'

I.e., it runs fine if I comment out the above two statements. I
think the passing of arguments is OK, because it works in the 
C program, but why do these FS...Fv names get referenced only
when I include the fortran calls in my C++ program?

Phil R Cummins                              address@hidden
Frontier Research for Subduction Dynamics  tel(i/d):81/0-468-67-3393
JAMSTEC, 2-15 Natsushima-cho               fax(i/d):81/0-468-67-3409
Yokosuka 237-0061, Japan              

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]