- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am working in MS Visual Studio 2005 in a mixed language project: Fortran and C++. Both languages are now working with C calling convention, but I need it to be stdcall. When I change the setting of my C++ project to _stdcall I got some linking errors like:
error LNK2019: unresolved external symbol _FUNCTION referenced in function _main
That function is called from the Fortran code (main).
I have a header file with a F77_FUNC() to deal with these function names calling convention thing, but I dont know how to change it to make it run in my project.
Maybe there is another form to make it run.
# define F77_FUNC(name,NAME) NAMELink Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Consult the IVF documentation regarding mixed language function calls. This is a particularly confusing area of programming. Sometimes light can be shed on the subject by requesting the Assembler File to be produced. By examining that file you can see the actual names generated for the function calls as well as the calling convention (like who is responsible for cleaning the stack of arguments).
In a pinch, you can have Fortran call a shell C subroutine with one calling convention then call the C++ function using the other calling convention.
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you don't want to do this, you can change the default calling convention to "STDCALL, REFERENCE" (/iface:stdref from the command line) but you'll probably also have to use ALIAS and DECORATE unless the C++ routines are all lowercase.

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