code
code copied to clipboard
FEAT: libRed Red/System binding
Made this just as a curiosity although I think it may be quite useful... currently I have 2 issues:
- once
redOpen
is called, the output fromprint
functions from hosting R/S app stops. - it is not possible to define
redRoutine
from R/S function
- That's expected, because they share the same underlying R/S runtime code.
- Try using a
[cdecl]
in the R/S function passed toredRoutine
.
-
it is not good... it would make difficult to use libRed loaded in app made in Red/System... isn't there some workaround? I would prefer to have
print
from the host then the lib, if I could choose. -
there is more problems... first... it is not allowed to cast function into int-ptr!, but I used intermediate casting which seems to make compiler satisfied. Unfortunately, although the routine is called now, there are strange values coming into it, so the result is wrong... what may be a reason?
Btw... I have libRed.dll made with rc "build libred"
- The stdcall version is completely wrong. With cdecl only the routine input is strange.
@dockimbel the redRoutine is working now as expected with the fix: https://github.com/red/red/commit/67cebfc50f30ab2caad3e057a51b96203ac864e2
Can someone confirm that this works? If so, I'll get it merged.
@9214 or @hiiamboris, can you confirm this PR is OK to merge?
@Oldes nice experiment! My 2 cents:
- Personally I would remove enums, since they are not used in the code and at least
RedType!
is outdated; the other way around is to update it, but then it needs to stay in sync with other eventual changes. - I like all the
#define
s and how they convey the intention, but IMO they should use-
rather than_
, to follow the naming conventions. That shouldn't cause any name clashing AFAIK, though I can be wrong. - Unfortunately I can't help you with the testing on macOS and GTK, perhaps someone else can spin up VMs and do some quick checking?
works (except for printf) on all platforms