You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I've skimmed Pyxell's documentation but didn't notice anything about an ffi, can Pyxell call C or C++? I assume that it has an easy cpp ffi since it compiles to c++.
The text was updated successfully, but these errors were encountered:
There is an undocumented extern keyword for declaring functions defined elsewhere. You can write something like this:
func sinh(x: Float): Float extern
After this declaration you can just use the sinh function in your Pyxell code. It works because cmath library is included by default.
To call functions from other libraries, you would also need to include a proper header file when compiling the C++ file (and probably also link the library if it's not header-only). Currently the only way to do so is to first transpile Pyxell code to C++ (with -s option), and then manually compile the C++ code with GCC or Clang (with -include <header_file> and optionally linking the library).
It's a good idea to add the full support for FFI (without 2-step compilation) and describe it in the documentation. Thanks!
Hello, I've skimmed Pyxell's documentation but didn't notice anything about an ffi, can Pyxell call C or C++? I assume that it has an easy cpp ffi since it compiles to c++.
The text was updated successfully, but these errors were encountered: