I'm trying to call the dlsym function from a program compiled with the waf build system, but am unable to link libdl using the wscript. This SEEMS like an extremely simple task but I've tried a million different things and have gotten nowhere.
Edit: It would be even better if there were a general way to add flags to the end of each build command. I've tried setting CXXFLAGS and other environment variables but they don't seem to change anything...
If you try to pass
use=dl
to the build command directly, waf will look in the config environment dict for "uselib variables" to tell it how to handle it.A minimal wscript to build a simple
test.c
program withdl
might look like this:Relevant documentation
Waf also provides a shorthand to avoid having to explicitly set
LIB_DL
:This is somewhat documented here
For the sake of completeness, here's the
test.c
file I used to test: