[C] 纯文本查看 复制代码
#include <Windows.h>
#include <stdio.h>
#include <intrin.h> // 所有Intrinsics函数
extern "C" void _cdecl abc(int *a)
{
*a = *a+2;
}
extern "C" void _cdecl getstr(char *st)
{
sprintf_s(st, 10, "%8s", "abc");
//strCPUId += buf; _cdecl
//st = "abc";
}
[Fortran] 纯文本查看 复制代码
!****************************************************************************
!
! PROGRAM: Console1test
!
! PURPOSE: Entry point for the console application.
!
!****************************************************************************
module computer
interface
!---------------------------------------------
subroutine abc(scput)
!! use iso_c_binding
!DEC$ATTRIBUTES C,ALIAS:'_abc'::ABC
!DEC$ATTRIBUTES reference::scput
integer scput
end subroutine
!! subroutine getstr(strr)
!! use iso_c_binding
!! !DEC$ATTRIBUTES C,ALIAS:'_getstr'::GETSTR
!! !DEC$ATTRIBUTES reference::strr
!! character strr(50)
!! end subroutine
!-----------------------------------------------
end interface
end module
program Console1test
use computer
! use, intrinsic :: iso_c_binding
! Variables
character sss(50)
integer :: ii=5
! Body of Console1test
!call getstr(str)
call abc(ii)
write(*,*) ii
!! call getstr(sss)
!! write(*,*) sss
print *, 'Hello World'
end program Console1test