- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear all!
Is it possible to point onto a target which is defined in a DLL?
Example:
module dll1
implicit none
type :: data1
integer :: i = 0
real :: r = 0.0
end type data1
type(data1), target :: globData = data1(0,0.0)
!DEC$ ATTRIBUTES DLLEXPORT :: globData
contains
subroutine initDLL1
!DEC$ ATTRIBUTES DLLEXPORT ::initDLL1
implicit none
print*,'init of globData'
globData = data1(12,23.4)
end subroutine initDLL1
end module dll1
program main
use dll1
implicit none
type(data1), pointer :: pData => null()
call initDLL1
print'(i5,1x,f9.5)',globData
print*
pData => globData
print'(i5,1x,f9.5)',pData
end program main
This example produces a run time error in the line: print'(i5,1x,f9.5)',pData
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
main.exe 00412C51 Unknown Unknown Unknown
main.exe 00403945 Unknown Unknown Unknown
main.exe 00402EEE Unknown Unknown Unknown
main.exe 0040114C _MAIN__ 12 main.f90
main.exe 00452148 Unknown Unknown Unknown
main.exe 0043DC3E Unknown Unknown Unknown
kernel32.dll 7C816FD7 Unknown Unknown Unknown
Thanks for any suggestions!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks as if you've found a compiler bug. I'll pass this on to the developers. I note that globdata is not seen properly in the main program either.
![](/skins/images/BC9A7A3465121B56B278007F4EE8899F/responsive_peak/images/icon_anonymous_message.png)
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