473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Calling subroutine in fortran module

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
5 4322
"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

"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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sascha T. | last post by:
Hi! I have desperately searched google and its groups in vain. Hope you can help with my problem. I need to call some ancient Fortran objects by C++-main program with the latest Intel Compiler...
4
by: Gunasekaran | last post by:
Dear all, I wrote a c program and tried to call NAG(desinged for FORTRAN)subroutine. I called as NAG as below d02bhf_( &x, &xend, &knor , y, &tol,&irelab, &hmax, &fcn, &g, w, &ifail);...
12
by: Bigdakine | last post by:
I don't know if this is the right forum for this, and if not please suggest one which fits. I have to call a fortran sub routine from a C main program. The fortran subroutine statement is ...
2
by: Ray J. | last post by:
I have a C++ program written and compiled on Solaris 8 with gcc. With gcc lets me compile fortran code along with the C++ program to be able to call the fortran code as a subroutine. The...
11
by: RichN | last post by:
I am developing a c program in Visual Studio .NET 2003. I also have an Intel(R) Fortran compiler for MVS .NET My fortran sourcecode already existed. I started a new fortran project and chose to...
2
by: singlal | last post by:
Hi, my question was not getting any attention because it moved to 2nd page; so posting it again. Sorry for any inconvenience but I need to get it resolved fast. Need your help! ...
13
by: Mangabasi | last post by:
Howdy, I have been trying to call the following Fortran function from Python (using Windows XP, Compaq Fortran and Python 2.4). I tried F2Py, Pyfort and calldll with no success. I think I...
3
by: =?Utf-8?B?TWFyZWs=?= | last post by:
Hi As well as trying to call a fortran dll with a structure parameter from a C# front end, we are trying to do this using AssemblyBuilder and MethodInfo to do it dynamically. Ultimately this will...
4
by: nitusa | last post by:
Hey Everyone, I am doing a VB6 to C# conversion and everything was going smoothly until I realized that I needed to call a Fortran 77 (.for) .dll inside my code. I have looked through everything...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.