majmudar@amalthea.rutgers.edu (Keyur Majmudar) (02/16/90)
"HELP! HELP! HELP! !!! I am trying to call an IMSL subroutine (qdags) [in FORTRAN] from a C program, but I have not been succesful in doing so. I keep on getting an error "Unresolved symbols .... - symbol : _qdags" If anybody has any good ideas please advise .... urgently, to, majmudar@jove.rutgers.edu thanks.
henry@utzoo.uucp (Henry Spencer) (02/17/90)
In article <Feb.15.22.58.45.1990.11984@amalthea.rutgers.edu> majmudar@amalthea.rutgers.edu (Keyur Majmudar) writes: >I am trying to call an IMSL subroutine (qdags) [in FORTRAN] from a C >program, but I have not been succesful in doing so. >I keep on getting an error "Unresolved symbols .... - symbol : _qdags" You need to look in your Fortran manual to find out the details of linking Fortran to C on your particular system. (It is almost impossible to give specific advice without knowing your machine or operating system.) Often to call Fortran routine "foobar" you need to call something like "foobar_" from C. Also, parameter-passing conventions are often different. You usually can't just call Fortran subroutines as if they were C functions. -- "The N in NFS stands for Not, | Henry Spencer at U of Toronto Zoology or Need, or perhaps Nightmare"| uunet!attcan!utzoo!henry henry@zoo.toronto.edu
LC.YRS@forsythe.stanford.edu (Richard Stanton) (02/17/90)
In article <1990Feb16.172952.24266@utzoo.uucp>, henry@utzoo.uucp (Henry Spencer) writes: >In article <Feb.15.22.58.45.1990.11984@amalthea.rutgers.edu> majmudar@amalthea.rutgers.edu (Keyur Majmudar) writes: >>I am trying to call an IMSL subroutine (qdags) [in FORTRAN] from a C >>program, but I have not been succesful in doing so. >>I keep on getting an error "Unresolved symbols .... - symbol : _qdags" > >You need to look in your Fortran manual to find out the details of linking >Fortran to C on your particular system. (It is almost impossible to give >specific advice without knowing your machine or operating system.) Often I agree with this advice. I have never actually got around to using IMSL or NAG from C, but it is something I may do in the near future. In case you are using VAX C / FORTRAN, the manuals talk in a fair amount of detail about how to do the calling process from C to FORTRAN and vice versa. The other thing to be aware of is that when you are linking your code, you will need to specify the IMSL library either in the command line, or as one of LNK$LIBRARY, LNK$LIBRARY_n where n = 1 or 2 (n can be up to 4 for FORTRAN, but C only uses up to 2). Hope this may help someone. Richard Stanton
yahoo@unix.cis.pitt.edu (Kenneth L Moore) (02/18/90)
In article <1990Feb16.172952.24266@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >In article <Feb.15.22.58.45.1990.11984@amalthea.rutgers.edu> majmudar@amalthea.rutgers.edu (Keyur Majmudar) writes: =>=>I am trying to call an IMSL subroutine (qdags) [in FORTRAN] from a C =>You need to look in your Fortran manual to find out the details of linking =>Fortran to C on your particular system. =>Also, parameter-passing conventions are often different. You =>usually can't just call Fortran subroutines as if they were C functions. I'll add an amen to that. When I was writing my master's thesis I had to call FORTRAN functions from a C program because of complex number manipulation (on our machine the FORTRAN intrinsic complex number arithmetic was much faster than using C routines). I had to read our system's manuals to be successful. I could not just call FORTRAN functions as if they were written in C. Especially if they had character strings, which require a string length in FORTRAN passes. I also had to set special loader flags to get it to work. However, after the initial effort, the result was flawless. So don't be discouraged. It only took me two days to get it working. (and I'm not all that swift!) -- I don't yell and I don't tell and I'm grateful as hell: Benny Hill