06-09-2025, 02:35 PM
I've compiled some commonly used C# functions into a DLL. When I want to use them, I need to call static functions from the DLL using the code below.
However, if I want to use functions from the DLL in multiple places, I have to run the same loading code each time, which increases resource overhead.
Is it possible to implement logic similar to how native DLLs are loaded — that is, load the DLL only once in the main function, and then directly call its functions in other parts without reloading it?
Macro Todo2
However, if I want to use functions from the DLL in multiple places, I have to run the same loading code each time, which increases resource overhead.
Is it possible to implement logic similar to how native DLLs are loaded — that is, load the DLL only once in the main function, and then directly call its functions in other parts without reloading it?
Macro Todo2
#sub ExeQmPlusDll
function!
;Use for qmplus.dll like ExeQmGridDll for qmgrid.dll.
#if EXE=1
#exe addfile "$qm$\qmplus.dll" 21089
int+ ___eqpd
if !___eqpd
,lock
,if !___eqpd
,,if !GetModuleHandle("qmplus.dll")
,,,_s.expandpath(F"$temp qm$\ver 0x{QMVER}\qmplus.dll")
,,,if !FileExists(_s)
,,,,if(!ExeExtractFile(21089 _s)) ret ;;also creates folders.
,,,if(!LoadLibraryW(@_s)) ret
,,___eqpd=1
#endif
ret 1