autoit-gui-skeleton / ags-wrapper-json

Simple wrapper of the library JSON.au3 provides with AGS framework.
https://autoit-gui-skeleton.github.io/
1 stars 1 forks source link

Error BinaryCall.au3 __MemoryModule_RuntimeLoader(): undefined function - inextricable #1

Closed camerling closed 1 year ago

camerling commented 1 year ago

BinaryCall.au3"(208,88) : error: __MemoryModule_RuntimeLoader(): undefined function

v20100v commented 1 year ago

Hi @camerling

Could you tell me what do you want to do ? and the context ? Did you install this component (ags-wrapper-json) with Yarn ? You can find more information how to install an AGS package here : https://autoit-gui-skeleton.github.io///blog/2018/07/10/ags_dependencies_manager_for_AutoIt.html.

In short, to install and test this component you need to do this in the Windows terminal :

# Create empty directory, and install it with Yarn
λ mkdir test && cd test
λ yarn add @autoit-gui-skeleton/ags-wrapper-json --modules-folder vendor

# You can find an exemple to execute into this directory
λ cd vendor\@autoit-gui-skeleton\ags-wrapper-json\test\

# Compile in console mode, and execute
λ aut2Exe /in testJson.au3 /console
λ testJson.exe

You should normally get the following result:

image

Here is an example how to read a JSON file with this library.

; Include
#Include "../JSON.au3"

Func Test1()
    Local $Json1 = FileRead(@ScriptDir & "\test.json")
    Local $Data1 = Json_Decode($Json1)
    Local $Json2 = Json_Encode($Data1)

    Local $Data2 = Json_Decode($Json2)
    Local $Json3 = Json_Encode($Data2)

    ConsoleWrite("Test1 Result: " & $Json3 & @LF)
    Return ($Json2 = $Json3)
EndFunc

Test1()
camerling commented 1 year ago

Capture d’écran 2022-11-23 204708

Almost the same error. I suppose there is a problem with my setup (dependencies) but I do not manage to find a way to correct it. I though you allready encounter the problem. Thanks Sir for your help.

v20100v commented 1 year ago

Hello,

Just to clarify, did you install the dependencies with Yarn ? And did you try to compile in a terminal the testJson.au3 as I show you above ? Could you tell me whet version of AutoIt are you using, and what version of Windows (WIN_11/2009) ?

Otherwise, I found a beginning of explanation here : https://www.autoitscript.com/forum/topic/173067-curl-udf-autoit-binary-code-version-of-libcurl-with-ssl-support/

camerling commented 1 year ago

Hi, Yes I have been using yarn. I compile with a 'F5' (Go) from SciTe because neither aut2Exe or aut3Exe is accessible from console. Context: Windows 11 pro - 22H2 The solution of replacing the code is working !

Many thanks v20100v !

Have a nice day Buddy !!!


If $HasMemoryDll Then
    Local $Module = Execute('__MemoryModule_ModuleRecord("get", Null, $DllName)')
    If $Module Then
        Local $MemoryGetProcAddress = Execute('__MemoryModule_RuntimeLoader("MemoryGetProcAddress")')
        If $MemoryGetProcAddress Then $Proc = DllCallAddress("ptr:cdecl", $MemoryGetProcAddress, "ptr", $Module, "str", $ProcName)[0]
        If Not $Proc Then Return SetError(2, _BinaryCall_LastError("MemoryGetProcAddress failed on " & $ProcName), False)
    EndIf
EndIf
camerling commented 1 year ago

Thanks to @v20100v !

v20100v commented 1 year ago

Sounds good @camerling !!!

Certainly due to a change in the Windows library (DLL) used by BinaryCall. There has not yet been a test with the 22H2 version. I will make a commit to fix it in the repository.