Skip to content

Is it possible to implement interoperability with C++ and Objective-C/C++? #217

Answered by cattokomo
przemyslaw0 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, it is possible. But requires you to write a wrapper for Nelua. Here's an example of interoperability with C++ in Nelua.

As you can see, there's a wrapper for the Hello library (hello.cpp). It contains functions that wraps C++ functions using extern "C". In hello.nelua, it contains several definition of libhello without nodecl attribute, and a code that'll run a function from hello.cpp using libhello.

It's basically like FFI <-> C++ method, you make a wrapper of it, compile it to shared library, and then use FFI to define and use the functions. Except the difference is, you don't use dlopen to get the functions, since you can define the functions into your .nelua, and also you're not …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@przemyslaw0
Comment options

@cattokomo
Comment options

Answer selected by przemyslaw0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants