Hello everyone,
I'm startin with C++ now and I want to call a FORTRAN subprogram with a parameter so fortran make some work with it.
How could I do it?
thankyou very much.
Hello everyone,
I'm startin with C++ now and I want to call a FORTRAN subprogram with a parameter so fortran make some work with it.
How could I do it?
thankyou very much.
meaning commandline? system()
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
Sorry, perhaps I wasn't as clear as I must.
I want to call a function written on FORTRAN.
how can I do it?
Thank you.
Well you wont be able to call it directly from your code, i.e you cant write fotran in a C++ program b/c the compiler will go nuts, if you really must use this routine, then make sure its in a dll or lib and then load it up and call it, im not sure how fortran works so you might want to use google and look up calling conventions and how to load code at runtime.
"only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein
that certainly isn't any more clear. your only way is to have it exported from a dll. load it in the c program. Aside from that I have NO idea what you're talking about. there's no such thing as inline FORTRAN unless I just missed that along the way
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
no theres no inline fortran unless your compiler supports that but i seriously doubt that it will. I think that the super exspensive version of VS.Net might support it but im not 100% sure. What is so important about the routine that you couldnt just re-write it in C++?
"only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein
I really donīt have a concret answer, but Iīm currently reading a book and I found that might be intressting...how to call a fortran subroutine
For example extern "ADA" can be used to declare functions written in the ADA language, extern "FORTRAN" for functions written in the FORTRAN language, and so on.Code:extern "C" { int printf(const char* ...) ... ... }
I donīt know how this work but try searching on google that have superier better examples then this one.
did some work for you...it looks like its very possible with the right tools...
http://www.thp.univie.ac.at/~jthorn/c2f.html