- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have some codes were written by C++. There are many CLASS definition. Is there any method could use variables and fumctions of C++ CLASS. Or I have to modify C++ code to C.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You cannot call C++ class members directly, at not easily. You don't have to rewrite the C++ code, but you can write either C-style wrappers or C++ static class member functions around C++ class methods. These are callable from Fortran as they don't expect this as the first hidden argument. You have to find the means to pass this (i.e. pointer to class object) around -- usually, you pass this from C++ to Fortran as an INTEGER, and pass it back to above-mentioned wrapper unmodified.
See this thread for a sample.
Jugoslav
Jugoslav
See this thread for a sample.
Jugoslav
Jugoslav

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