#Rust/C++ interop without static linking

7 messages · Page 1 of 1 (latest)

trim matrix
#

Hi, i'm developing a mod for a game and i need to be able to access cpp classes from Rust.
I only need to define the types, not actual implementations as they are not statically linked and instead resolved dynamically.
Initially i looked into cxx and autocxx but i believe none are able to do this.
Is there any crate for this?

Note: I have started work on cpp header parser that simply generates rust structs and virtual methods along with type definitions of non-virtual ones, but this has proven very difficult due to the complexity of cpp object layout.

raw patio
#

I'm just a beginner when it comes to Rust. And yet, with what little I know, I can tell you: that is not possible.

Rust is a very nice improvement of the C language. Not C++. C. The existing interop mechanism integrates well with C stuff - not C++. We sometimes forget those are different languages.

In order to do integration with C++, wrapping is the only way, I'm bery much afraid to say.

mint storm
trim matrix
#

Yes it seems like what i wanted was not possible with such requirements

#

So I decided to focus on implementing something like this for MSVC specific as I know the target program was compiled with it.
This way I can just safely implement the macro I was working on by taking account the implementation details of MSVC

In case anyone cares, a good reference I have found is the following: https://www.openrce.org/articles/files/jangrayhood.pdf

fresh dagger
#

for the type defs use bindgen, for the dynamic part well you can use libloading.