Re: Run-time check #4 from VC in VS2005

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Dave Moran wrote:
> Hi Will
>
> This is my function pointer declaration:
>
> typedef void ( __stdcall * lpF77Func) (void);
>
> This is my Fortran subroutine:
>
> SUBROUTINE BLEVCF (IGAS)
> CDEC$ ATTRIBUTES DLLEXPORT :: BLEVCF
> INTEGER IGAS
> ...
> END
>
> I wasn't sure which order things came off the stack, but I figured
> that with one item on the stack this wouldn't be an issue.

I'm pretty sure that's declaring a __cdecl function in fortran, not
__stdcall as you're attempting.

Try changing your typedef to __cdecl and add code to your asm trampoline to
pop the arguments off the stack after the functions returns.

-cd


.