Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!think!ames!ucbcad!ucbvax!decvax!dartvax!vallury From: vallury@dartvax.UUCP (RustCat) Newsgroups: comp.lang.c Subject: Fortran vs. C strings Message-ID: <6480@dartvax.UUCP> Date: Tue, 16-Jun-87 01:07:26 EDT Article-I.D.: dartvax.6480 Posted: Tue Jun 16 01:07:26 1987 Date-Received: Sun, 21-Jun-87 08:55:24 EDT Reply-To: vallury@dartvax.UUCP (RustCat) Distribution: world Organization: Dartmouth College, Hanover, NH Lines: 49 Hello, This essentially regards calling a Fortran routine from a C program. To be more specific, I'm trying to do this on the VMS in order to write a C interface for the GKS-Plot10 set of Fortran routines. I have no problems with numbers (ints or floats). This is pretty straightforward. The C source simply needs to pass the addresses of the variables to the Fortran routine and all is fine. Unfortunately, the same doesn't seem to work with strings or character variables. I keep getting stack dumps irrespective of whether I send the string with single quotes, or double quotes around it. There was one other way of doing this and it seemed to partially work. That is as follows: In the C source code, I use the following scheme, extern char[30] GKString; strcpy (GKString, "..."); Fortran_Routine (); And in the corresponding Fortran routine, COMMON/GKString/MyString ... In this case, I don't get the stack dumps, but the string simply doesn't seem to be getting transmitted to the GKS plotting routine (GTX for example) properly. Would this be due to some sort of string terminator syntax difference between the two languages? Once again, I've tried enclosing the string both in single and double quotes but it doesn't work. Have any of you come across this problem before? And managed to get over it? This IS on the VMS and I guess the Unix format for external language addressing might not work. I'd appreciate any possible solutions or pointers to tackling these 2 related problems, namely 1) how to pass string variables directly and 2) the actual representation of strings (and terminators) between the two languages. E-mail would probably be preferable since I don't spend too much time on here these days. Thank you. Vallury vallury@dartcms1.BITNET vallury@dartvax.UUCP