mystor / rust-cpp

Embed C++ directly inside your rust code!
Apache License 2.0
802 stars 44 forks source link

Use __attribute__((weak)) for the metadata #29

Closed ogoffart closed 6 years ago

ogoffart commented 6 years ago

This allows to use two crates that both use the cpp! macro without getting linking error.

Since the metadata does not matter once the crate is compiled, it should, in fact, not even be needed in the binary.

An alternative would have been to use some random identifier in the namespace, but this approach means that at most only one metadata will be in the final binary.

mystor commented 6 years ago

Unfortunately that attribute is not supported by MSVC, which is one of the supported C++ compilers. You'll have to add support for that before I can merge this :-)

ogoffart commented 6 years ago

Sorry for forgetting MSVC.

BTW, what's the license of the crate?

mystor commented 6 years ago

It's currently dual-licensed Apache/MIT - I should probably add the license files into the root at some point.