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
wload(starttime , duration, station, component, dataray, nsamp, calib, srate,
samplength, datadir)
And the variables are defined
real*8 starttime
real duration
character*(*) sta
character*(*) component
integer*4 dataray(1)
integer nsamp,samplengt h
real calib,srate
character*100 datadir
Of these, starttime, duration, station, component are inputs. dataray is an
integer vector created in the C-program via dataray = calloc(65000,
sizeof(int))
In the C-code I have the following variable defs..
double starttime
char sta[5], component[4]
char *datadir
float duration, calib, srate
But I can't get the call to the fortran sub to work with robustness. Do you
have any pointers as to how the c-variables should be defined and a function
prototype for wload_ that could accomplish that?
If you know of a good FAQ on this, that would work for me too...
Yours,
Stuart
Dr. Stuart A. Weinstein
Ewa Beach Institute of Tectonics
"To err is human, but to really foul things up requires a creationist"
"Creationis ts aren't impervious to Logic: They're oblivious to it." 12 2901
Bigdakine wrote: 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
wload(starttime , duration, station, component, dataray, nsamp, calib, srate, samplength, datadir)
And the variables are defined
real*8 starttime real duration character*(*) sta character*(*) component integer*4 dataray(1) integer nsamp,samplengt h real calib,srate character*100 datadir
Of these, starttime, duration, station, component are inputs. dataray is an integer vector created in the C-program via dataray = calloc(65000, sizeof(int))
In the C-code I have the following variable defs.. double starttime char sta[5], component[4] char *datadir float duration, calib, srate
But I can't get the call to the fortran sub to work with robustness. Do you have any pointers as to how the c-variables should be defined and a function prototype for wload_ that could accomplish that?
If you know of a good FAQ on this, that would work for me too...
Yours,
Stuart
Dr. Stuart A. Weinstein Ewa Beach Institute of Tectonics "To err is human, but to really foul things up requires a creationist"
"Creationis ts aren't impervious to Logic: They're oblivious to it."
The answer will depend on your platform and what compilers you are
using. You need to look at the C and Fortran compiler manuals for your
platform. Note that the solution will probably not be portable.
--
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Common User Interface Services
M/S 2R-94 (206)544-5225 bi*******@aol.c omGetaGrip (Bigdakine) wrote in message news:<20******* *************** *****@mb-m17.aol.com>... 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
wload(starttime , duration, station, component, dataray, nsamp, calib, srate, samplength, datadir)
And the variables are defined
real*8 starttime real duration character*(*) sta character*(*) component integer*4 dataray(1) integer nsamp,samplengt h real calib,srate character*100 datadir
Of these, starttime, duration, station, component are inputs. dataray is an integer vector created in the C-program via dataray = calloc(65000, sizeof(int))
In the C-code I have the following variable defs.. double starttime char sta[5], component[4] char *datadir float duration, calib, srate
But I can't get the call to the fortran sub to work with robustness. Do you have any pointers as to how the c-variables should be defined and a function prototype for wload_ that could accomplish that?
If you know of a good FAQ on this, that would work for me too...
A quick search on Google revealed ... http://www.aei.mpg.de/~jthorn/c2f.html
Regards,
Mark.
Bigdakine wrote: I don't know if this is the right forum for this and, if not, please suggest one which fits.
comp.lang.fortr an
I need to call a fortran subroutine from a C main program.
The fortran subroutine statement is
wload(starttime , duration, station, component, dataray, nsamp, calib, srate, samplength, datadir)
And the variables are defined
real*8 starttime real duration character*(*) station character*(*) component integer*4 dataray(1) integer nsamp,samplengt h real calib,srate character*100 datadir
Of these, starttime, duration, station, component are inputs. dataray is an integer vector created in the C-program via dataray = calloc(65000, sizeof(int))
In the C-code I have the following variable defs.. double starttime char sta[5], component[4] char *datadir float duration, calib, srate
But I can't get the call to the fortran sub to work with robustness. Do you have any pointers as to how the c-variables should be defined and a function prototype for wload_ that could accomplish that?
void wload_(double*, float*, char*, char*, int*, int*,
float*, float*, int*, char*, int, int, int);
wload_(&startti me, &duration, sta, component, dataray,
&nsamp, &calib, &srate, &samplength, datadir,
strlen(sta), strlen(componen t), strlen(datadir) );
In article <ch**********@n ntp1.jpl.nasa.g ov>,
E. Robert Tisdale <E.************ **@jpl.nasa.gov > wrote: Bigdakine wrote:
I don't know if this is the right forum for this and, if not, please suggest one which fits.
comp.lang.fortr an
Unclear. I suspect the main reason this advice is given is b/c clf is not
anal about topicality, as clc, almost uniquely so, is.
Really, this question, how do I interface foo with bat, isn't topical for
either the followers of foo or the followers of bar. It falls in between,
in a land that neither wants to touch (*). In fact, it is really is
a vendor issue - it concerns the vendors of the two products in question
(i.e., the vendors of foo and bar together can answer the question).
(*) Somewhat related: I've often wondered where on Usenet, one could ask
questions about Cygwin. Talk about neither fish nor fowl! Neither the
Unix people or the Windows people would want to touch it.
>Subject: Re: Calling fortran subroutine from c From: "E. Robert Tisdale" E.************* *@jpl.nasa.gov Date: 9/1/04 7:56 AM Hawaiian Standard Time Message-id: <ch**********@n ntp1.jpl.nasa.g ov>
Bigdakine wrote:
I don't know if this is the right forum for this and, if not, please suggest one which fits.
comp.lang.fortr an
I need to call a fortran subroutine from a C main program.
The fortran subroutine statement is
wload(starttime , duration, station, component, dataray, nsamp, calib, srate, samplength, datadir)
And the variables are defined
real*8 starttime real duration character*(*) station character*(*) component integer*4 dataray(1) integer nsamp,samplengt h real calib,srate character*100 datadir
Of these, starttime, duration, station, component are inputs. dataray is an integer vector created in the C-program via dataray = calloc(65000, sizeof(int))
In the C-code I have the following variable defs.. double starttime char sta[5], component[4] char *datadir float duration, calib, srate
But I can't get the call to the fortran sub to work with robustness. Do you have any pointers as to how the c-variables should be defined and a function prototype for wload_ that could accomplish that?
void wload_(double*, float*, char*, char*, int*, int*, float*, float*, int*, char*, int, int, int);
wload_(&startti me, &duration, sta, component, dataray, &nsamp, &calib, &srate, &samplength, datadir, strlen(sta), strlen(componen t), strlen(datadir) );
Ahhh. Yes. I had forgotten that. Its been a while since I had to do this. The
dimensions get appeneded to the end.
Thanks! I'm sure that will do the trick!
Stuart
Dr. Stuart A. Weinstein
Ewa Beach Institute of Tectonics
"To err is human, but to really foul things up requires a creationist"
"Creationis ts aren't impervious to Logic: They're oblivious to it."
Kenny McCormack wrote: E. Robert Tisdale wrote:
Bigdakine wrote:
I don't know if this is the right forum for this and, if not, please suggest one which fits. comp.lang.fortr an
Language interoperabilit y *is* topical in comp.lang.fortr an
Platform specific questions are accepted in comp.lang.fortr an
only because there is no other appropriate forum.
Platform specific questions are handled in comp.lang.c
by redirecting them to a more appropriate forum. Unclear. I suspect the main reason this advice is given is b/c clf is not anal about topicality, as clc, almost uniquely so, is.
Responding to off-topic posts is inappropriate behavior.
If you must respond, please try to be polite and helpful.
Redirect the post to a more appropriate forum.
Really, this question, how do I interface foo with bat, isn't topical for either the followers of foo or the followers of bar. It falls in between, in a land that neither wants to touch (*). In fact, it is really is a vendor issue - it concerns the vendors of the two products in question (i.e., the vendors of foo and bar together can answer the question).
(*) Somewhat related: I've often wondered where on Usenet, one could ask questions about Cygwin. Talk about neither fish nor fowl! Neither the Unix people or the Windows people would want to touch it.
In my opinion, language interoperabilit y is *always* topical
in the comp.lang.c as well as in the comp.lang.fortr an newsgroup
but Fortran programmers have more experience with it
because it is more important to them.
Kenny McCormack wrote:
.... snip ... (*) Somewhat related: I've often wondered where on Usenet, one could ask questions about Cygwin. Talk about neither fish nor fowl! Neither the Unix people or the Windows people would want to touch it.
The cygwin mailing list. Much more restrictive than here, and you
also have no idea what the problem is.
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
In article <41************ ***@yahoo.com>,
CBFalconer <cb********@wor ldnet.att.net> wrote: Kenny McCormack wrote: ... snip ... (*) Somewhat related: I've often wondered where on Usenet, one could ask questions about Cygwin. Talk about neither fish nor fowl! Neither the Unix people or the Windows people would want to touch it.
The cygwin mailing list. Much more restrictive than here, and you also have no idea what the problem is.
(I have no idea what your post means)
Kenny McCormack wrote: CBFalconer <cb********@wor ldnet.att.net> wrote: Kenny McCormack wrote: ... snip ... (*) Somewhat related: I've often wondered where on Usenet, one could ask questions about Cygwin. Talk about neither fish nor fowl! Neither the Unix people or the Windows people would want to touch it.
The cygwin mailing list. Much more restrictive than here, and you also have no idea what the problem is.
(I have no idea what your post means)
You wanted to know where to ask questions about Cygwin. I told
you.
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: NM |
last post by:
Hello All
I am writing some progam that involves both C++ and Fortran. Some of the
existing code is in Fortran. The main program will be in C++ and it will
call some Fortran subroutine. All the memory allocation has to be done in
C++.
For arrays of structures and arrays (including multi-dimensional array) of
primitive data types declared in Fortran, I know the corresponding data
structures in C++. So I can declare those data structures...
|
by: Adrian |
last post by:
I am trying to pass the address of a C++ function into a Fortran
routine to enable the Fortran routine to call this C++ function. I
have to do it this way as our build process does not allow circular
dependencies of DLL's.
Does anyone know how to do this, I have tried everything in my book.
I have a C++ function GetP:
DllExport void GetP()
|
by: Sam |
last post by:
Hello all
I have a two dimensional array (the dimensions are not known) that
needs to be passed
to fortran from c++, allocate the dimensions of the array in fortran
code, do some filling up
of the array in fortran and then accessing it in my c++ code.
Say in my c++ code I have;
extern "C" { void foo_(float **, int &, int &); }
|
by: NM |
last post by:
Hello all,
I am supposed to do some mixed programming with c++ and fortran.
I was succeeful in exchanging the 2D arrays from fortran to c++ and the
other way, but was unable
to that same with the 3D arrays, the values passed are not all the
same. I am also pasting the fortran and c++ codes so that you could
have a look at them.
////C++ Code
|
by: Amit |
last post by:
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)
| |
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 specifications for this project have
changed and I am porting the C++ code to Visual C++. Is there a way to call
fortran code from a C++ program compiled with Visual C++?
|
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 create a dynamic link library. The beginning of the fortran code
looks like:
SUBROUTINE SFTCK3
!DEC$ ATTRIBUTES DLLEXPORT::SFTCK3
|
by: Cottonwood |
last post by:
I want to call a C module from a Fortran program. Whatever I tried -
the linker could not find the C module. I know about the leading
underscore and switched even that off. I abstracted everything
possible. When I replace the C module by a Fortran subroutine linking
works. Here the Fortran subroutine that replaced the C module for
testing:
subroutine qqcprint
return
end
|
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 I have found using Google and have still been unable to get it to successfully work. Currently the following call works about 75% of the time, but the other 25% of the time my program just calls the .dll and then it simply exits; no...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |