-
Notifications
You must be signed in to change notification settings - Fork 8
nativeType
Abe Pralle edited this page Oct 6, 2022
·
1 revision
nativeType<<"c-value-type-name">> NativeTypeName
local data = native( ''(NativeTypeName) { value }'' )->NativeTypeName
native @|c-value-type-name value = $data.value
nativeType<<"char*">> RogueCString
routine printf( string:RogueCString ) [essential]
native @|printf( "%s\n", $string.value );
endRoutine
local arg = native(''(RogueCString){"Hello World!"}'')->RogueCString
printf arg
nativeType<<"c-value-type-name">> NativeTypeName
declares a Rogue compound / C struct type which contains a single property value
of type c-value-type-name
. The resulting wrapper or container type has the same name in Rogue and in C.
Native types are used to wrap (or contain) arbitrary C types that can be passed between Rogue and C code. Rogue code never "understands" what's in the opaque native type data, but C code can create wrapped values, send the wrapper to Rogue, and retrieve the wrapped .value
later.