- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Has anyone called a C# function, in a dll, from Fortran ? If so, does it work the same a calling a C function with regards to linking and setting up the interface? I can call Fortran from C# but have not had luck going from the other direction.
I'm now thinking about using a callback mechanism because I'll have a lot of back and forth. Does anyone have a callback example whereFortran callsback to C# with a function pointer?
I'm now thinking about using a callback mechanism because I'll have a lot of back and forth. Does anyone have a callback example whereFortran callsback to C# with a function pointer?
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The C# code is in .NET managed code - you could use the "Fortran Module Wizard" to generate Fortran interfaces to the C# code's methods. This is under Tools.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
The C# code is in .NET managed code - you could use the "Fortran Module Wizard" to generate Fortran interfaces to the C# code's methods. This is under Tools.
I am going to use CALL SYSTEM("csharp_program.exe") to launch a console program to do its deed and then close and return to Fortran. This should work for my immediate needs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. If you'd like to do it without a console window opening up, try the Win32 API ShellExecute.

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