By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,705 Members | 2,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,705 IT Pros & Developers. It's quick & easy.

Calling subroutine in fortran module

P: n/a
I tried calling a subroutine in a fortran module from C ,but couldn't.I
always get the error: undefined reference in the main.o file (main is
in C calling the subroutine).

for calling the subroutine I used the following name:
modulename_MP_subroutinename_(...)
and all possible variant (upper case,lower case).Can anybody help (for
a unix system)

Nov 14 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Amit" <ku*****@gmail.com> writes:
I tried calling a subroutine in a fortran module from C ,but couldn't.I
always get the error: undefined reference in the main.o file (main is
in C calling the subroutine).

for calling the subroutine I used the following name:
modulename_MP_subroutinename_(...)
and all possible variant (upper case,lower case).Can anybody help (for
a unix system)


Probably not here. The C language doesn't define the mechanism for
calling Fortran subroutines; it's likely to depend on the OS and on
the C and Fortran compilers. If the documentation for your Fortran
compiler doesn't have the information you need, you might try
comp.unix.programmer.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #2

P: n/a

"Amit" <ku*****@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
I tried calling a subroutine in a fortran module from C ,but couldn't.I
always get the error: undefined reference in the main.o file (main is
in C calling the subroutine).

for calling the subroutine I used the following name:
modulename_MP_subroutinename_(...)
and all possible variant (upper case,lower case).Can anybody help (for
a unix system)

man nm
Nov 14 '05 #3

P: n/a
Amit wrote:

I tried calling a subroutine in a fortran module from C ,but
couldn't.I always get the error: undefined reference in the main.o
file (main is in C calling the subroutine).

for calling the subroutine I used the following name:
modulename_MP_subroutinename_(...)
and all possible variant (upper case,lower case).Can anybody help
(for a unix system)


Not here. It's off topic and not remotely portable nor
standardized. Try a newsgroup that deals with your particular
system and compiler(s).

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #4

P: n/a
Amit wrote:
I tried calling a subroutine in a Fortran module from C but couldn't.
I always get the error: undefined reference in the main.o file
(main is in C calling the subroutine).

for calling the subroutine I used the following name:
modulename_MP_subroutinename_(...)
and all possible variant (upper case,lower case).
Can anybody help (for a unix system) man nm

NM(1) GNU Development Tools NM(1)

NAME
nm - list symbols from object files
Nov 14 '05 #5

P: n/a
On Sun, 30 Jan 2005 06:34:44 GMT, Keith Thompson <ks***@mib.org>
wrote:
"Amit" <ku*****@gmail.com> writes:
I tried calling a subroutine in a fortran module from C ,but couldn't.I
always get the error: undefined reference in the main.o file (main is
in C calling the subroutine).

for calling the subroutine I used the following name:
modulename_MP_subroutinename_(...)
and all possible variant (upper case,lower case).Can anybody help (for
a unix system)


Probably not here. The C language doesn't define the mechanism for
calling Fortran subroutines; it's likely to depend on the OS and on
the C and Fortran compilers. If the documentation for your Fortran
compiler doesn't have the information you need, you might try
comp.unix.programmer.


Or comp.lang.fortran, who do accept crosslanguage issues (as c.l.c
with its much higher traffic does not) and whose regulars have
experience with such issues on a variety of systems. But it is true
the correct answer frequently depends on your Fortan compiler (and
options) and sometimes your OS and/or C compiler, so specify them.

- David.Thompson1 at worldnet.att.net
Nov 14 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.