Re: Challenge: Build a Color-Coded Log Viewer for Phix/Euphoria (Inspired by chat.exw)
- Posted by xecronix 2 weeks ago
- 484 views
I tested this with a trivial example:
Pascal Code:
library hello_export; uses Classes, SysUtils; {$H+} function say_hello(): PChar; begin Result := 'Hello from FreePascal DLL!'; end; exports say_hello; begin end.
And the Euphoria that runs it:
include std/dll.e include std/machine.e include std/pretty.e include std/filesys.e sequence dll_name = "hello_export.dll" printf(1, "loading dll: %s\n", {dll_name}) atom lib = open_dll(dll_name) atom hello = define_c_func(lib, "say_hello", {}, C_POINTER) atom ptr = c_func(hello, {}) sequence msg = peek_string(ptr) printf(1, "Returned from DLL: %s\n", {msg})
My only proof it works:
Owner@DESKTOP-VHI2MMV MINGW64 /c/dev/fpc_units/simple_dll $ eui hello_eu.ex loading dll: hello_export.dll Returned from DLL: Hello from FreePascal DLL!