- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a pre-sales question. Our group has been provided with Fortran 90 source library to which we must provide C bridge routines to certain entry points. We will then build the Fortran 90 and C into a single shared object on Linux Redhat 4.0. The shared object's Cbridgeroutineswill then be invoked via the dlopen() and dlsym() functions by another application.
We do not have the optionof linking the Fortran 90 and C bridges statically into the main application.
The main application which will load the .so file and call the entry point has a restriction that the called routine, the bridge in this case,must havethe equivalent of aC prototype of (int argc, char *argv[]). Our C bridge would then recast the pointers and pass them to Fortran.
We are currently attempting to solve this problem using a competing company's Fortran compiler. We can successfully build the .so file and invoke the C bridge, but at the point where the Fortran 90 is called, a stack error results. We suspect it's because the Fortran runtime is not being loaded and we've been unable to locate anything in their documentation that might provide us with direction for initializing the runtime.Thecompany's technical support has not been able to solve the problem.
We are interested in knowing if anyone has built and used such a thing on Linux using Intel Fortran. We have been successful using this calling mechanism on WinXP by constructing a DLL using an evaluation license for Intel Fortran and MS Visual Studio.
We would be open to switching Fortran compilers if we could be assured that we would be likely to meet with success. We can also provide short example C and F90 code that exemplifies the problem (a total of only 12 KB) if anyone wants to have a go.
Thanks,
Jim P.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you passing structures by reference in these C bridge functions?? Or using common blocks between the two? If so, it could very well be a memory alignment issue.
The C and FORTRAN compilers don't neccesarily align things the same in memory. There are compiler options to tweak this stuff on both sides. What has worked for me recently is using "-align none" on the intel fortran side - but as you may see in another recent post by me, this isn't without some issues of its own.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page