Last active
December 28, 2018 23:21
-
-
Save rgchris/e23e7fb5d0691e4faa068d5d9aad2a2a to your computer and use it in GitHub Desktop.
Attempt to CALL libRed from Rebol 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/rebview -iqvs | |
Rebol [ | |
Title: "libRed Test" | |
Author: "Christopher Ross-Gill" | |
Date: 19-Dec-2018 | |
] | |
libred: make object! [ | |
library: load/library %libRed.dylib | |
; from Ruby example: | |
; attach_function :redOpen, [], :void | |
; attach_function :redClose, [], :void | |
; attach_function :redDo, [ :string ], :pointer | |
open: make routine! [ | |
return: [char] | |
] library "redOpen" | |
close: make routine! [ | |
return: [char] | |
] library "redClose" | |
do: make routine! [ | |
source [string!] return: [integer!] | |
] library "redDo" | |
] | |
libred/open | |
libred/do "print {Hello Rebol 2, I'm Red}" | |
libred/close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
libRed description here: https://github.com/red/red/wiki/%5BDOC%5D-libRed