I'm trying to integrate ChaiScript into my little Mac / c++ project. While I'm able to use it just fine by building chaiscript_stdlib.hpp / using ChaiScript chai(Std_Lib.library()), I really would like to build the library separately.
However after building the dylib, making sure the install path / name points to the right place, and building my project with it, I invariably get a runtime error that it cannot find the .dll ... Needless to say I'm profoundly confused as to why it would even look for a dll on mac, but could anybody share some light on what I am doing wrong?
Cheers!
P.S.: just to be extra clear, the error is not about locating the .dylib (which would come first if I don't copy the lib in the executable path), but after loading the dylib at runtime it complains it cannot find the .dll
Without knowing the exact error you are getting, I'm guessing you are mis-reading the error message.
ChaiScript does not discriminate against file extension when looking for its runtime library. It also does not try to load more than one standard library. This is to deal with the fact that mingw/cygwin builds might generate .so or .dll files or whatever, depending on the whim of the developers. So, on all platforms, ChaiScript attempts to find a library with the possible set of extensions (.so
, .dll
, ``)
If you are building the standard library as a dylib
you are probably building it wrong. A dylib is a shared library, while either a .so
or a .bundle
is a loadable module, referencing here:
http://fink.thetis.ig42.org/doc/porting/shared.php
CMake compiles loadable modules on MacOS using the .so
extension, which is what ChaiScript uses when searching for the library.
Please make sure you are compiling the standard library as a shared module as appropriate for your platform. I believe -bundle
needs to be passed to the linker.