Skip to content

Instantly share code, notes, and snippets.

@baptistelabat
Last active June 16, 2016 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baptistelabat/f4b0bbe69ea31974fb27da27fb23760d to your computer and use it in GitHub Desktop.
Save baptistelabat/f4b0bbe69ea31974fb27da27fb23760d to your computer and use it in GitHub Desktop.
g++ -c test.cpp -o test.o
INTEGER CR2
N=10
CALL CR1(N,M)
WRITE(6,20) N,M
20 FORMAT(' The square of',I3,' is',I4)
K=CR2(N)
WRITE(6,30) N,K
30 FORMAT(' The cube of',I3,' is',I15)
CALL EXIT
END
extern "C"
{
void __stdcall CR1(int *,int *);
int __stdcall CR2(int *);
}
void __stdcall CR1(int *n, int *m)
{
// Compute the square of n, return in m
int k;
k=*n;
*m=k*k;
return;
}
int __stdcall CR2(int *n)
// Compute the cube of n
{
int m,k;
k=*n;
m=k*k*k;
return m;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment