Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

DLL data as TARGET

Anonymous54
Beginner
279 Views

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!
0 Kudos
1 Reply
Steven_L_Intel1
Employee
279 Views
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.
0 Kudos
Reply