5 ms·
It's `mmap` call and syntax of function pointer at the end of the file (needed to call the compiled code). P.S. Otherwise, it is ready to run itself, work in p
by dmytrish 12y ago
It's `mmap` call and syntax of function pointer at the end of the file (needed to call the compiled code).
P.S. Otherwise, it is ready to run itself, work in progress.
- userbinator 12y agoAllowing it to call arbitrary functions using dlopen()/dlsym() would be the idea I have for fixing the first problem - it'd also increase its power substantially since it can then make use of any other library's functions instead of the currently hardcoded list. Supporting function pointers would be a bit harder and involve changing the parser/code generator.
- hyc_symas 12y agoHow would you tell it which shared library to dlopen? Was looking into changing the order of arguments to go the right way 'round. Also changing address refs to be PC-relative, to avoid the relocation phase. Seems pretty straightforward.
- dmytrish 12y agoI thought about `dlopen`, but did not know how to fetch it libc platform-independently (`dlopen(argv[0])` is fine on OS X, but not on Linux). Now I see that the first argument can be NULL, that approach is feasible.