- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
By default, IVF will generate a DLL to be called by VC++ through _cdecl. How to make a IVF DLL to be called by VC++ by STDCALL?
I have already changed calling convention within VC compiler to be __stdcall (/Gz). I tried the following simple code but got warning like[ warning C4007: 'main' : must be '__cdecl' ].
Thanks...
//FORTRAN PART
Subroutine MYDLL(t)
!DEC$ ATTRIBUTES DLLEXPORT, STDCALL:: MYDLL
integer::t
t=t+2;
return
End Subroutine
//VC PART
#include "stdafx.h"
extern "C" void __stdcall mydll(int *intg);
void main()
{
int intg = 2 ;
mydll(&intg);
}
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You don't need the /Gz as you put __stdcall in the declaration for "mydll". The only thing you need to do is add the REFERENCE attribute to the !DEC$ ATTRIBUTES line, as STDCALL changes the passing mechanism to VALUE.
Make sure that the C code is built with the same run-time library option (/MD) as the DLL is (defaults to /MD or /libs:dll). If you are building in Visual Studio, use /MDd for a debug configuration.
Make sure that the C code is built with the same run-time library option (/MD) as the DLL is (defaults to /MD or /libs:dll). If you are building in Visual Studio, use /MDd for a debug configuration.

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