Closed gyuro closed 3 weeks ago
Hi @gyuro -- you can pass custom flags to the C compiler/linker that Codon uses to generate the shared library via the -linker-flags
argument of codon
, e.g.
codon build ... -linker-flags '-ltest' ... run.codon
Does that work in your case?
Yes, it appears to be functioning. However, should LIBRARY
still be configured in the codon? Is it possible to import functions from the shared library without specifying LIBRARY
?
If you're linking the libtest.so
library then you should be able to just use from C import
without specifying the library explicitly:
from C import test(float, float) -> float
Does that work?
Amazing, it functions perfectly. Appreciate your help
I'm working on a project where the main function calls a
run
function, which is linked to an exported codon library (librun.so
). This codon library, in turn, is linked to a shared library namedlibtest.so
.However, I'm facing a challenge because the codon build doesn't have a feature that allows the user to include a dependent library when creating a shared library. This is causing inconvenience as I have to update the library path each time, especially since the library name changes with every run due to some reason.
Could you give me a solution to import the dependent library for the codon build?
Here's my code:
In
main.cpp
:In
run.codon
:In
libtest.so
:These are the commands that I used to build.