- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I wrote an dynamic link library below, and it is successfully builtto an dll.
butI don't know how ro call it.
!!!!!!!!!!!!!!!!the dll below !!!!!!!!!!!!!!!!!!!!!!!!!!
module MM
!DEC$ OBJCOMMENT LIB:'libiomp5md.lib'
include 'link_fnl_static_hpc.h'
USE numerical_libraries
real:: A(2),B(2), INV(2,2)
END MODULE MM
!
!
MODULE FF
INTERFACE
subroutine Dis
Use MM
end subroutine Dis
END INTERFACE
END MODULE FF
!
!
subroutine MainSub(AA,BB)
!DEC$Attributes Stdcall , Dllexport , Alias : 'MainSub' :: MainSub
!DEC$Attributes Reference :: AA,BB
Use MM
use FF
real:: AA(2),BB(2)
A=AA
B=BB
call Dis
end subroutine MainSub
!
!
subroutine Dis
Use MM
implicit none
real :: C
INV=reshape((/1.0,0.0,0.0,2.0/),(/2,2/))
C=BLINF(2, 2, INV, 2,A, B)
print*,C
end subroutine Dis
!
!!!!!!!!!!!!!!!!!!!!!!!! the program mainpto call the dll below !!!!!!!!!!!!!!!!!!!!!!!!!!!
program Mainp
INCLUDE 'link_fnl_shared.h'
!DEC$ OBJCOMMENT lib:"libiomp5md.lib"
implicit none
Interface
Subroutine MainSub(A,B)
Real :: A(2),B(2)
End Subroutine
End Interface
real:: AA(2),BB(2)
AA=(/1.0,1.0/)
BB=(/2.0,0.0/)
call MainSub(AA,BB)
end program Mainp
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
My compiler is : IVF 11.1.051,IMSL6.0, win7, IA32, VS2008 .
thanks !
zlzgj
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Second, you have not added a !DEC$ ATTRIBUTES DLLEXPORT directive for any of your routines. Without that, there is no export library created and you can't call any routines. In each routine you want callable, add:
!DEC$ ATTRIBUTES DLLEXPORT :: routinename
Then when you link the DLL, a .lib will be created. Build the calling program with this library.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for your help. according to what you said, I tried it again and I did it.
thanks you very much!
zlzgj

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page