Silverfrost Forums

Welcome to our forums

Passing INTEGER*2 arguments using STDCALL convention fails

2 Aug 2011 10:25 #8684

My initial test for this issue is as follows

C function...

#include <stdio.h>
extern 'C' void __stdcall PassIntegers(char i1Arg, short i2Arg, int i3Arg)
{
  printf('%d\\n', i1Arg);
  printf('%d\\n', i2Arg);
  printf('%d\\n', i3Arg);
}

Fortran program...

program test
 STDCALL PassIntegers 'PassIntegers'(VAL,VAL,VAL)
 integer*1 i1
 integer*2 i2
 integer*4 i3
 i1 = 7
 i2 = 45
 i3 = 19
 call PassIntegers(i1,i2,i3)
end program test

This works OK and I don't know how I can progress from here.

When you compile a function/subroutine using FTN95, arguments are always passed (in) by reference but you can pass arguments (out) by value from FTN95 when the function/subroutine is compiled using some other compiler such as SCC.

2 Mar 2012 10:47 #9739

When attempting to pass an int2 (val, stdcall), does the ftn95 compiler simply promote this to an int4 and pass this instead?

2 Mar 2012 4:03 #9743

Yes. If you look at the /explist produced by program test above, then this appears to be the case.

Please login to reply.