Skip to content

Instantly share code, notes, and snippets.

@rgchris
Last active December 28, 2018 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgchris/e23e7fb5d0691e4faa068d5d9aad2a2a to your computer and use it in GitHub Desktop.
Save rgchris/e23e7fb5d0691e4faa068d5d9aad2a2a to your computer and use it in GitHub Desktop.
Attempt to CALL libRed from Rebol 2
#!/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
@rgchris
Copy link
Author

rgchris commented Dec 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment