- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
to call a dll from Fortran, I encountered the following error:
----
Compilation Aborted (code 3)
----
what is the problem, thank you very much for your explaination.
----------------------------------------------
PROGRAM DLLTEST
use kernel32
! USE DFWIN
IMPLICIT NONE
INTERFACE
SUBROUTINE ARRAYTEST (sarray)
!DEC$ ATTRIBUTES DLLIMPORT:: ARRAYTEST
REAL(4) sarray(3, 7)
END SUBROUTINE ARRAYTEST
END INTERFACE
REAL(4) sarray(3,7)
integer:: p
pointer (q, ARRAYTEST)
! First, locate the dll and load it into memory
p = loadlibrary("ARRAYtest.dll"C)
if (p == 0) then
type *, "Error occurred opening ARRAYtest.dll"
type *, "Program aborting"
stop
endif
! Set up a pointer to the routine of interest
q = getprocaddress(p, "ARRAYarr"C)
if (q == 0) then
type *, "Error occurred finding ARRAYarr in ARRAYTEST.dll"
type *, "Program aborting"
stop
endif
CALL ARRAYTEST(sarray)
WRITE(12,*) sarray(:,:)
END PROGRAM DLLTEST
----
Compilation Aborted (code 3)
----
what is the problem, thank you very much for your explaination.
----------------------------------------------
PROGRAM DLLTEST
use kernel32
! USE DFWIN
IMPLICIT NONE
INTERFACE
SUBROUTINE ARRAYTEST (sarray)
!DEC$ ATTRIBUTES DLLIMPORT:: ARRAYTEST
REAL(4) sarray(3, 7)
END SUBROUTINE ARRAYTEST
END INTERFACE
REAL(4) sarray(3,7)
integer:: p
pointer (q, ARRAYTEST)
! First, locate the dll and load it into memory
p = loadlibrary("ARRAYtest.dll"C)
if (p == 0) then
type *, "Error occurred opening ARRAYtest.dll"
type *, "Program aborting"
stop
endif
! Set up a pointer to the routine of interest
q = getprocaddress(p, "ARRAYarr"C)
if (q == 0) then
type *, "Error occurred finding ARRAYarr in ARRAYTEST.dll"
type *, "Program aborting"
stop
endif
CALL ARRAYTEST(sarray)
WRITE(12,*) sarray(:,:)
END PROGRAM DLLTEST
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't get an error when compiling this source with 9.0.030.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page