Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple tutorials/examples #127

Closed
musm opened this issue Nov 12, 2018 · 3 comments
Closed

Simple tutorials/examples #127

musm opened this issue Nov 12, 2018 · 3 comments

Comments

@musm
Copy link
Contributor

musm commented Nov 12, 2018

Is there any additional more tutorial style documentation available? Currently MATLAB.jl wraps the C api, but this has severe limitations and reduced functionality when compared to the Cpp api. I'd like to wrap the Cpp API, but I'm a beginner and don't often use cpp so would like some simple tutorial on how to use this package.

BTW does it matter if we use cpp libs compiled with msvc toolchain in julia? I know when using C I have to use a mingw based toolchain or else it won't load.

@barche
Copy link
Collaborator

barche commented Nov 13, 2018

I think the current examples are a good starting point, for example the C++ code for the types example shows how to add non-template types and functions:
https://github.com/JuliaInterop/libcxxwrap-julia/blob/master/examples/types.cpp#L142
This is loaded on the Julia side here:
https://github.com/JuliaInterop/CxxWrap.jl/blob/master/test/types.jl

One difference between the examples and a real module is that they lack an __init__ function, which is required for precompilation.

I recently updated QML.jl so that is also a working example. The C++ site is in a separate repository at: https://github.com/barche/jlqml

For MSVC, it should work well, but libcxxwrap-julia must be compiled with MSVC as well. There are actually binaries for that available here, but they are not used automatically, so you have to extract them and set the JLCXX_DIR environment variable to the directory where they are unpacked.

@musm
Copy link
Contributor Author

musm commented Nov 13, 2018

I'm having a hard time figuring out where exactly libcxxwrap-julia / jlcxx exist?

The current README is for juliapro and for an older version of julia. With the newest Pkg manager the directories are kinda hard to locate.

@barche
Copy link
Collaborator

barche commented Nov 13, 2018

Ah yes, I forgot about that. You can locate it using:

using CxxWrap
dirname(dirname(CxxWrap.libcxxwrap_julia))

Or if you want something more predictable for development, you can extract or build libcxxwrap where you want, and point CxxWrap to it by setting JLCXX_DIR and then doing Pkg.build on CxxWrap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants