This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Fortran to C


Hi Toon

Thanks for your mail. I will try to get an example posted soon. What I
had meant earlier is that, in a fortran code, I am calling a C function
with a string parameter. On the C side, I have the function receiving
the string as char * with the string len. Now the string len is declared
as a long. This is causing a problem. These functions with the variable
declarations worked fine when in 32-bit as long and int have the same
size. However, we are in the process of porting to 64-bit and this
declaration of long for the string len is causing problems. My question
was pertaining to this declaration of long for the length of the string
being passed.

Thanks and Regards

Vardhan 

-----Original Message-----
From: Toon Moene [mailto:toon@moene.org] 
Sent: Monday, August 02, 2010 12:57 PM
To: Vardhan, Sundara (GE Energy)
Cc: gcc-help@gcc.gnu.org
Subject: Re: Fortran to C

Vardhan, Sundara (GE Energy) wrote:

> Hi All
> 
> I am using gcc 4.4.3 on Linux to compile 64-bit applications. I am 
> having issues when fortran callable c-functions have long parameters 
> are called by fortran programs, then dump core. Does gfortran on Linux

> pass integer length parameters rather than long? I would very much 
> appreciate your input.

It helps if you give us an exact example (i.e., the Fortran and C source
and the flags and command lines you used to compile and link those into
one executable).  For instance, I have no idea what you mean by "[d]oes
gfortran [...] pass integer length parameters rather than long" - if you
pass an integer on the Fortran side, expect an int * on the C side.

Hope this helps,

--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290 Saturnushof
14, 3738 XG  Maartensdijk, The Netherlands At home:
http://moene.org/~toon/; weather: http://moene.org/~hirlam/ Progress of
GNU Fortran: http://gcc.gnu.org/gcc-4.5/changes.html#Fortran


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]