- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- How to call Fortran routine from C++ code ?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 08:26 AM
тАО12-23-2008 08:26 AM
How to call Fortran routine from C++ code ?
NB: I can call the same routine from C code without any issue. Also tried to have C function as an intermediate call (between C++ and Fortran) but I'm having the same Link issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 08:56 AM
тАО12-23-2008 08:56 AM
Re: How to call Fortran routine from C++ code ?
hiding all the code, you're hiding the
compile and link commands, and you're hiding
almost all of the error message(s), and you
expect a useful answer?
> NB: I can call the same routine from C [...]
Ever look at the system header files and see
things like this?:
[...]
#ifdef __cplusplus
extern "C" {
#endif
[...]
#ifdef __cplusplus
}
#endif
[...]
I'm not a C++ expert, but I believe that
those things are in there for a reason. (And
it's related to those funny names.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 10:59 AM
тАО12-23-2008 10:59 AM
Re: How to call Fortran routine from C++ code ?
The complex external name is caused by "name mangling". Somewhat simplified, name mangling encodes the parameter list type information and the external name.
I do not have the time to check Steve's syntax, but the approach is correct, having constructed cross-language calls to/fro C++ many times.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 11:16 AM
тАО12-23-2008 11:16 AM
Re: How to call Fortran routine from C++ code ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 07:00 PM
тАО12-23-2008 07:00 PM
Re: How to call Fortran routine from C++ code ?
The define should automatically be added by the compiler. And if your header is always used by C++, you don't need that #ifdef, just create an extern "C" block.
Unfortunately there is no: extern "fortran" :-)
>Robert: I do not have the time to check Steve's syntax
The syntax is correct for a file that is shared between C and C++.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-23-2008 08:17 PM
тАО12-23-2008 08:17 PM
Re: How to call Fortran routine from C++ code ?
> problem.
I assume that adding the
extern "C" {[...]}
part is what made the difference.
> The define should automatically be added by
> the compiler. [...]
You seem to assume that the solution report
was somehow connected with reality. Ha!
> The syntax is correct [...]
I expect correctness when I steal from
(SYS$COMMON:[DECC$LIB.REFERENCE.DECC$RTLDEF]STDIO.H).