Please login or register.

Login with username, password and session length
gfx gfx
1619 Posts in 535 Topics by 781 Members - Latest Member: chekyl43 January 27, 2023, 05:05:54 PM
gfx* Home | Help | Search | Login | Register | gfx
Absoft User Forum  |  Support  |  Windows  |  How to late-load a DLL

Author Topic: How to late-load a DLL  (Read 6193 times)

Mike Linacre

  • Sr. Member
  • ****
  • Posts: 259
How to late-load a DLL
« on: May 17, 2007, 10:05:51 PM »
This is useful if the DLL may not exist, or may be a different version to the developer's, or may not have the module, ....

C Do this once to get the entry point
       Subroutine GetDLLEntryPoint (YourEntryPoint)
       stdcall external LoadLibraryA, GetProcAddress
       integer*4 LoadLibraryA, GetProcAddress
       integer*4 pl, pm, plvalue, YourEntryPoint
       character*100 LibraryName, ModuleName
       LibraryName = "KERNEL32.DLL"//char(0)
       ModuleName = "SetFilePointerEx"//char(0)
       pl = loc(YourLibraryName)
       plvalue = LoadLibraryA (val(pl))
       if ( then
         pm = loc(YourModuleName)
         YourEntryPoint = GetProcAddress (val(plvalue), val(pm))

C Do this each time you need to access the module in the DLL
       if ( then
         call YourDLLModule (val(YourEntryPoint),val(your parameter 1), val(),...)

C This does the DLL module access
       SUBROUTINE YourDLLModule (YourEntryPoint, your parameter 1, ...)
       STDCALL EXTERNAL YourEntryPoint
       integer*4 iostat, your parameter 1, ....
       iostat = YourEntryPoint (val(your parameter 1), ....)

Absoft User Forum  |  Support  |  Windows  |  How to late-load a DLL

gfx gfx
Powered by MySQL Powered by PHP Valid XHTML 1.0! Valid CSS!