- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello, I wonder if this can work?
*)dll subroutine:
subroutine Test(array)
!DEC$ ATTRIBUTES DLLEXPORT :: Test
use dflib
implicit none
character($MAXPATH), allocatable :: array(:)
integer n
n=4
allocate(array(n))
array(1)='A '
array(2)='B '
array(3)='C '
array(4)='D '
end subroutine
*)caller subroutine
...
...
interface
subroutine Test(array)
!DEC$ ATTRIBUTES DLLIMPORT :: Test
use dflib
implicit none
character($MAXPATH), allocatable :: array(:)
end subroutine
end interface
...
...
call Test(array)
...
...!do something with array
...
deallocate(array)
*)dll subroutine:
subroutine Test(array)
!DEC$ ATTRIBUTES DLLEXPORT :: Test
use dflib
implicit none
character($MAXPATH), allocatable :: array(:)
integer n
n=4
allocate(array(n))
array(1)='A '
array(2)='B '
array(3)='C '
array(4)='D '
end subroutine
*)caller subroutine
...
...
interface
subroutine Test(array)
!DEC$ ATTRIBUTES DLLIMPORT :: Test
use dflib
implicit none
character($MAXPATH), allocatable :: array(:)
end subroutine
end interface
...
...
call Test(array)
...
...!do something with array
...
deallocate(array)
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is not standard Fortran 95, but having an ALLOCATABLE routine argument is part of a "Technical Report" for Fortran 2000 which is implemented by CVF 6.6B. This should work in that version of CVF. Make sure that the EXE is linked against the DLL form of the Fortran run-time library (the project wizard asks you if you'll be using a Fortran DLL when you create the project - say yes.) Otherwise the deallocate will fail.
Steve
Steve

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