Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Prevent duplicate loading of compiled C# DLL components.
#1
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.
Code:
Copy      Help
CsScript x.SetOptions("inMemoryAsm=false"); x.Load(":12 $qm$\pyn.dll")

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
Code:
Copy      Help
#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


Messages In This Thread
Prevent duplicate loading of compiled C# DLL components. - by Davider - 06-09-2025, 02:35 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)