red-system

How to pass value from Red/System to Red?

三世轮回 提交于 2020-06-23 12:37:07
问题 I need to pass the value that I generate in Red/System to Red. I discovered docs but did not find an example of how to use it. Here is my code: Red [] #system [ data!: alias struct! [ a [integer!] b [c-string!] ] data: declare data! _foo: func [return: [data!]] [ data/a: 123 data/b: "Hello" return data ] ] sqlite: context [ my-red-block: []; I want to place here: 123 "Hello" foo: routine [ /local x [data!] ] [ x: _foo ; next line do now work ; push my-red-block x/a ] ] view [button "Select"

Pass by reference in Red routines

江枫思渺然 提交于 2019-12-10 16:37:52
问题 So I'm currently in the process of migrating a descent sized program from Rebol 3 to Red. Said program relies on a large binding to a C library (clang). I have rewritten the binding portion in Red/System, and am interfacing that code with Red through wrapper routines. The current convention I have been using is to cast the pointers and void pointers needed as parameters and returned by the C code to red/system integers and box them up as Red integers. This is fairly easy and convenient. Since