先贴代码[Fortran] 纯文本查看 复制代码 program s
!<-------------------------------------------------------------------------------------------------------------------------------
use link_cont
use dfwin !< win api
!<-------------------------------------------------------------------------------------------------------------------------------
implicit none
integer(kind=4) :: add
integer(kind=4) :: a,b
integer(kind=4) :: hwnd
integer(kind=4) :: n_case
integer(kind=4) :: n_data
integer(kind=4) :: lpool
character(len=40), dimension(10) :: c_files
logical :: fail
logical :: syslink
!<-------------------------------------------------------------------------------------------------------------------------------
!<-------------------------------------------------------------------------------------------------------------------------------
pointer(add,FileOpenCont)
hwnd = LoadLibrary('control.dll'C)
if (hwnd <= 0) then
fail = .true.
syslink = .false.
pause 'DLL Loading failure because control.dll was not found'
else
write(*,*) 'Succeed Contempt DLL (control.dll) Loading'
add = GetProcAddress(hWnd,'FILEOPENCONT'C)
call FileOpenCont(n_case,n_data,lpool,c_files)
endif
end program s
[Fortran] 纯文本查看 复制代码 module link_cont
interface
subroutine FileOpenCont (ncase,ndata,lpool,xfiles)
!MS$ ATTRIBUTES DLLIMPORT :: FileOpenCont
integer(kind=4) :: ncase
integer(kind=4) :: ndata
integer(kind=4) :: lpool
character(len=40), dimension(10) :: xfiles
endsubroutine FileOpenCont
endinterface
endmodule link_cont
问题描述:
1. 代码为工程使用,用于调用C语言dll库。编译时不需要dll库,所以没有贴出。
2. 此两段代码在CVF下可以编译通过,
而在IVF下编译会报错:error #6401: The attributes of this name conflict with those made accessible by a USE statement. [FILEOPENCONT]
指的是FILEOPENCONT重名,不知道如何修改,让原有功能同时实现,请教各位大大。
|