Call a function in a shared library: Difference between revisions
Call a function in a shared library (view source)
Revision as of 11:55, 17 November 2023
, 6 months ago→{{header|Wren}}: Capitalize Wren & C file names.
m (→{{header|Wren}}: Changed to Wren S/H) |
m (→{{header|Wren}}: Capitalize Wren & C file names.) |
||
Line 2,079:
{{trans|C}}
An embedded program so we can ask the C host to call the shared library function for us.
<syntaxhighlight lang="wren">/*
var RTLD_LAZY = 1
Line 2,120:
<br>
Finally, we embed the Wren script in the following C program, compile and run it:
<syntaxhighlight lang="c">/* gcc
#include <stdio.h>
Line 2,219:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
|