- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the best way to call a Microsoft C++ routine from Intel Visual Fortran? I would prefer to create a MS C++ library and then link it into my application and call it direct rather than making a C++ DLL and then calling the DLL.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's a pretty broad question. You can do what you prefer (C++ static library that a Fortran program links to, or vice versa). Is there some particular aspect that you want more information on?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apologies if it was too broad. I would prefer a MS C++ static library that I would just call from Intel Fortran. I would just set up a data structure in the Fortran and pass its pointer to the C++ routine which would contain an equivalent structure. How to pass the data back and forth is not a problem.
The main thing I'm unsure about is what pragmas, etc are required in the Fortran and C++ so that they link and communicate with each other properly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Declare the C++ function with extern "C", use BIND(C) on the Fortran side, and in general away you go...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For usage of BIND(C) there are useful examples you can find by search engines (perhaps as ISO C interop). Fortunately, this is an aspect of Fortran which generally is treated accurately. Multiple rank arrays aren't so pretty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
schulzey wrote:
Apologies if it was too broad. I would prefer a MS C++ static library that I would just call from Intel Fortran. I would just set up a data structure in the Fortran and pass its pointer to the C++ routine which would contain an equivalent structure. How to pass the data back and forth is not a problem.
The main thing I'm unsure about is what pragmas, etc are required in the Fortran and C++ so that they link and communicate with each other properly.
See this thread on this forum, quote #6 for an example:
https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/699941
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page