How to load a shared library #22147
-
Vlang version : I have the shared libraries in 'lib/'. The library I'd like to load is 'functions.so' and it contains only one function named 'fib'. I haven't been able to use this library with the information in the docs The Shared library was compiled with V too.
Loading the library:
And compiling it with: It outputs the following:
The I have tried using both relative and absolute paths. I also tried changing the module name in File tree:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Is seems that get_or_create_dynamic_lib_loader doesn't load any symbols automatically. Probably, this is by design. Looking at the |
Beta Was this translation helpful? Give feedback.
Is seems that get_or_create_dynamic_lib_loader doesn't load any symbols automatically. Probably, this is by design.
If you do
sym := dl_loader.get_sym('fib')!
then
sym_map
gets updated.Looking at the
loader.v
,sym_map
is being used as a cache for symbols resolved byget_sym
.