[C] syntaxhighlighter_viewsource syntaxhighlighter_copycode
#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";
}
[C] syntaxhighlighter_viewsource syntaxhighlighter_copycode
#pragma once
#ifndef LIB_H
#define LIB_H
extern "C" void _cdecl abc(int *a);
extern "C" void _cdecl getstr(char *st);
#endif
[C] syntaxhighlighter_viewsource syntaxhighlighter_copycode
LIBRARY "dlltt"
EXPORTS
abc @ 1
getstr @ 2
[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
!****************************************************************************
!
! 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