2021-12-13 08:43:13 hi crc 2021-12-13 08:44:10 hi inlight 2021-12-13 14:05:34 Welcome, larsb ! 2021-12-13 14:05:42 Hello, and thanks! 2021-12-13 14:49:28 Factor reveal party! 2021-12-13 14:49:53 Sorry, I typed to the wrong channel. 2021-12-13 15:04:17 good evening 2021-12-13 15:14:29 today's progress: I implemented byte array concatenation, byte array copy, and aliased most of the byte array words under s: (for strings) 2021-12-13 15:15:37 tomorrow I'll start work on the temporary string pool and lit32 for inlining larger values into a definition 2021-12-13 16:40:56 hi crc 2021-12-13 16:41:17 so i am trying to create stack based vm in windows in c 2021-12-13 16:42:23 if i need to call library functions like printf from stdio.h, how can i implement this in vm opcode, without creating a special opcode for printf- otherwise using this method i have to create opcode for all library functions 2021-12-13 16:45:26 the normal way would be to define a foreign function interface to translate between your vm and the external library function calling conventions 2021-12-13 16:47:18 if I remember correctly, on Windows, you'll want to look at the LoadLibrary and GetProcAddress functions 2021-12-13 16:51:42 ah yes 2021-12-13 16:51:48 do i need to use winapi ? 2021-12-13 16:52:47 but loadlibrary and getproc are used to load dynamic Dll and import exported func address 2021-12-13 16:53:02 anyways, can you give me some reference code of foreign function interface 2021-12-13 16:53:25 crc, 2021-12-13 16:54:13 and what about statically linked library, like printf,scanf,etc - if i want to write all of them in vm's opcode 2021-12-13 16:54:45 how would the vm translate the opcode to actuall call function ? 2021-12-13 16:54:56 I don't have a functional FFI in my vm models yet. Ngaro in the latest Retro12 release has a limited one for Unix (I do very little with Windows) 2021-12-13 16:55:29 Retro9 had an FFI, but is written in x86 assembly; not usjng a VM 2021-12-13 16:55:46 I don't know how to do an FFI for static linking 2021-12-13 16:55:50 i just need reference, 2021-12-13 16:55:58 any OS- i can learn and implement myself 2021-12-13 16:58:02 ah yes, all there lib functions in the end call osapis 2021-12-13 16:58:09 so- FFI should work 2021-12-13 16:59:28 otherwise, another way could be- if i dont want to use FFI is implementing printf function, which will finally call the interrupt to write on stdout 2021-12-13 17:00:05 after setting the regs, could this be a way ? 2021-12-13 17:00:20 https://github.com/cirosantilli/cpp-cheat/blob/81ab30c55634db24216e89ada1e0f271cac074e7/shared-library/basic/dlopen.c shows use of dlopen/dlsym on linux; same approach works on BSD and macOS; Windows would be similar 2021-12-13 17:00:57 windows doesn't use an interrupt to write to stdout, as far as ai can recall 2021-12-13 17:03:09 (it's been well over a decade since I did any low level work with Windows, so my memory here is possibly incomplete) 2021-12-13 17:06:43 ah 2021-12-13 18:15:29 ccx, are you related to kivutar ? 2021-12-13 18:15:41 maintainer of retroarch- jean 2021-12-13 18:26:52 no