- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
I have a problem when exporting code to DLL using the DLLEXPORT markup. This is compiler version XE 4.0.0.103 on IA-32. I. My main subroutine that I want other applications to be able to access is called subroutine User_Mod(...). I write:
!DEC$ ATTRIBUTES DLLEXPORT,StdCall,Reference,ALIAS:"User_Mod" :: User_Mod (1)
However, this gives an error from the compiler:
usrmod.obj : error LNK2019: unresolved external symbol _USER_MOD referenced in function _CLASS_LABTEST_mp_RESULTTABLE.
usrmod.dll : fatal error LNK1120: 1 unresolved externals
(the reason is because the subroutine User_Mod is called elsewhere in the exported code). If I then try to change the export line to:
!DEC$ ATTRIBUTES DLLEXPORT,StdCall,Reference,ALIAS:"User_Mod" :: _User_Mod (i.e. with underscore) (2)
the code compiles and a dll is created which is great. However the external program that will be using the DLL does not recognize it, so the DLL export will have to be written as in (1). The code works well if I generate an executable, however I am unsure how to solve this problem with underscore. . Any help or prior experience regarding this would be greatly appreciated.
Thanks.
Jon
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a way around the problem. It was to create a dummy subroutine called User_Mod which then calls the subroutine which I originally wanted to use, i.e.:
subroutine User_Mod (...)
!DEC$ ATTRIBUTES DLLEXPORT,StdCall,Reference :: User_Mod
!Dummy subroutine
! Actual subroutine
call User_Mod2(...)
end subroutine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Providing an interface body for User_Mod at the point of the problematic call was another option.

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