AT LAST !!!! I DID IT!!! The problem was that I was not storing a crucial value for an instance variable , so the void pointer was wrong. Corrected and I can see now the "hello" string inside Pharo :) Now I can exchange data between C++ and Pharo and use that to call C++ functions/methods inside a C++ executable from Pharo. Unreal and Pharo can now become a reality. Huge thank you for Esteban and UFFI, awesome :D UFFI is far easier than I expected , but still I would like some more information for how to dereference pointer . On Mon, Nov 7, 2016 at 10:30 PM Dimitris Chloupis <kilon.alios@gmail.com> wrote:
So I managed to port all C++ functions to pharo, which basically includes the following
Not full definition of function
open() lseek() close() mmap()
I have tested them all, they all return proper values from inside Pharo and Pharo does not crash.
it seems also that mmap works because it returns a void pointer as it should. This pointer points to the shared memory where I have put the string "hello" from another C++ program that has shared the memory .
So how can from Pharo take the void pointer
"(void*)@ 16rFFFFFFFF"
and retrieve the string "hello" that it points to ?
Essentially I want to dereference the pointer
I tried to send the message fromCString to the void pointer (ExternalData) but it crashed Pharo.
Another question, is it possible to cast a pointer ? (I do this with C++ programm) so can I cast from pharo the void pointer to a string pointer ?
I have also no idea if the void pointer points to a proper memory address , the documentation says that all pointers live in head but I have no way to confirm this.
I am so close to sharing memory between Pharo and C++ that I can smell it :D