- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using Intel Fortran 11.1.065 on Windows and the following program causes an access violation
when I compile it (using default options):
! chk.f90 --
! Simple program to check why iso_c_binding causes
! an ICE
!
module chk
use user32
use kernel32
use iso_c_binding
type hq_type
double precision :: h
double precision :: q
end type
contains
subroutine read_hq( location, hq_data )
character(len=*) :: location
type(hq_type), dimension(*) :: hq_data
integer :: p, q
pointer (q, ReadHQ)
type(c_ptr) :: hq_data_c
integer, dimension(1) :: hq_data_length
p = loadlibrary ("library.dll"C) ! the C at the end says add a null byte as in C
q = getprocaddress (p, "_ReadHQ"C)
call ReadHQ ( location, hq_data_c, hq_data_length )
call c_f_pointer( hq_data_c, hq_data, hq_data_length )
end subroutine read_hq
end module
While I prefer to link against the DLL instead of loading it this way (we had some trouble doing it via linking), the compiler should not abort.
Regards,
Arjen
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Having solved that and a few other issues in the actual code (I reduced it to this example) I now
have a working program.
(A confusing messageduring that process was the linkercould not find _c_f_pointer - this was solved
when Iintroducedan interface block to a C++ function I am using, or at least so it seems)
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you tell me more about the linker error? Are you using any switches such as /names:as_is? Can you show me a test case that gives that error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Arjen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Arjen

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