- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There appears to be a compiler error resulting from the following code segment:
module Junk
contains
function Test(pS,S1,S2)
!DEC$ ATTRIBUTES DLLEXPORT, REFERENCE, alias:"Test" :: Test
logical Test
character (*), pointer :: pS
character (*), intent(in), target :: S1
character (*), intent(in), target :: S2
integer (4), automatic :: iPS,iL1, iL2
iPS = len(pS)
iL1 = len(S1)
iL2 = len(S2)
pS => S1
Test = .true.
return
end function
end module
program StringPointer
use Junk
character (32), pointer :: pS
logical bret
bret = Test(pS,'123','ABCDEFG')
end program StringPointer
Inspection of the disassembled version demonstrates that with the DLLEXPORT directive then the code generated to call Test(..) has five parameters put on the stack: the addresses of the pointer pS and the two static strings, plus the length of the two static strings. No length associated with the string pointer pS is put on the stack. In contrast, the disassembly of the function shows that it is expecting six parameters, i.e., incluiding the length of pS. The corresponding values of iPS, iL1 and iL2 are 3, 7 and zero.
Removing the DLLEXPORT causes the compiler to include a length for the pointer pS in both places.
I can (and have) worked around this problem, but it took a while to track down the cause.
Stuart
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Stuart
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Issue ID is DPD200233584
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page