Call a function in a shared library: Difference between revisions

m
→‎{{header|Wren}}: Capitalize Wren & C file names.
m (BaCon and BBC BASIC moved to the BASIC section.)
m (→‎{{header|Wren}}: Capitalize Wren & C file names.)
 
(One intermediate revision by the same user not shown)
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="ecmascriptwren">/* call_shared_library_functionCall_a_function_in_a_shared_library.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 call_shared_library_functionCall_a_function_in_a_shared_library.c -o call_shared_library_functionCall_a_function_in_a_shared_library -ldl -lwren -lm */
 
#include <stdio.h>
Line 2,219:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "call_shared_library_functionCall_a_function_in_a_shared_library.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
Line 2,241:
Same as C example depending on whether fakeimglib.so is present in the current directory or not.
</pre>
 
=={{header|X86-64 Assembly}}==
===UASM 2.52===
9,485

edits