MemoryFreeLibrary


Build in function to free the Library loaded from Memory by MemoryLoadLibrary.
Based on http://www.joachim-bauch.de/tutorials/load_dll_memory.html

MemoryFreeLibrary(hLibrary)

Parameters

Parameter

Description

hLibrary

The handle returned by MemoryLoadLibrary().

Return Value

This function does not return a value.

Remarks

None.

Related

AutoHotkey.dll, ahkdll, ahktextdll, ahkReady, addFile, addScript, ahkExec, ahkLabel, ahkFunction, ahkPostFunction, ahkassign, ahkgetvar, ahkTerminate, ahkReload, ahkFindFunc, ahkFindLabel, ahkPause, ahkExecuteLine, Alias, cacheEnable, FindFunc, FindLabel, getTokenValue, getVar, Static, AutoHotkeyMini, DynaCall, CriticalSection, CriticalObject, MemoryLoadLibrary, ResourceLoadLibrary, MemoryGetProcAddress, Other Changes

Example

SetWorkingDir % A_ScriptDir
; Similar to DllCall("LoadLibrary",...)
dll:=MemoryLoadLibrary("AutoHotkey.dll")

; Similar to DllCall("GetProcAddress",...)
ahktextdll:=MemoryGetProcAddress(dll,"ahktextdll")
ahkTerminate:=MemoryGetProcAddress(dll,"ahkTerminate")

; Call exported function
DllCall(ahktextdll,"Str","MsgBox","Str","","Str","","Cdecl UInt")
MsgBox Thread running
DllCall(ahkTerminate,"Int",0) ;exit thread
; Free Library from Memory
MemoryFreeLibrary(dll)