- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to export a procedure pointer but it does not show up in the DLL's exported symbols
Code for the DLL:
module dll_proc_ptr
abstract interface
subroutine a_callme
end subroutine
end interface
procedure(a_callme), pointer :: r_callme
!DEC$ ATTRIBUTES DLLEXPORT :: r_callme
contains
subroutine test_call
!DEC$ ATTRIBUTES DLLEXPORT :: test_call
if(associated(r_callme)) then
call r_callme
else
print *, "r_callme not associated"
endif
end subroutine
end module
Code for the calling program
program test_proc_ptr use dll_proc_ptr call test_call r_callme => my_callme call test_call contains subroutine my_callme print *, "this is my_callme" end subroutine end program
If I omit the DLLEXPORT and link the module statically it works:
C:\TEMP\x>ifort dll_proc_ptr.f90 /c Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.0.110 Build 20150815 Copyright (C) 1985-2015 Intel Corporation. All rights reserved. C:\TEMP\x>ifort test_proc_ptr.f90 dll_proc_ptr.obj Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.0.110 Build 20150815 Copyright (C) 1985-2015 Intel Corporation. All rights reserved. Microsoft (R) Incremental Linker Version 11.00.61030.0 Copyright (C) Microsoft Corporation. All rights reserved. -out:test_proc_ptr.exe -subsystem:console test_proc_ptr.obj dll_proc_ptr.obj Creating library test_proc_ptr.lib and object test_proc_ptr.exp C:\TEMP\x>test_proc_ptr r_callme not associated this is my_callme C:\TEMP\x>
However when I compile the module as a DLL, the procedure pointer is not exported and the link of the test program fails of course:
C:\TEMP\x>ifort dll_proc_ptr.f90 /dll
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.0.110 Build 20150815
Copyright (C) 1985-2015 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 11.00.61030.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:dll_proc_ptr.dll
-dll
-implib:dll_proc_ptr.lib
dll_proc_ptr.obj
Creating library dll_proc_ptr.lib and object dll_proc_ptr.exp
C:\TEMP\x>dumpbin -exports dll_proc_ptr.dll
Microsoft (R) COFF/PE Dumper Version 11.00.61030.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file dll_proc_ptr.dll
File Type: DLL
Section contains the following exports for dll_proc_ptr.dll
00000000 characteristics
564D8BDC time date stamp Thu Nov 19 09:44:12 2015
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 00001010 DLL_PROC_PTR_mp_TEST_CALL
Summary
1000 .data
1000 .pdata
1000 .rdata
1000 .reloc
1000 .text
C:\TEMP\x>
I don't see in the documentation of the DLLEXPORT attribute that it excludes procedure pointers.
Johny
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You posted the same code twice. Please correct the second code (for the main program).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Oops, I'm sorry.
I have updated my post.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for bringing this to our attention - we'll take a look. Issue ID is DPD200378960.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect this to be fixed in Update 2 (February).
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