0

I think it's impossible or very dangerous to send pointer / reference to dynamic loaded library from another compiler or ever another languages like C#. And I want to find proofs, but C++ standard documentation is pretty huge.

I think null terminated string will work fine, but how about std::string, or maybe string_view?

ShadowRanger
  • 143,180
  • 12
  • 188
  • 271
LynXz
  • 78
  • 8

1 Answers1

2

C++ does not standardize ABI.

In practice, different std::string implementations may employ small string optimization differently tuned (with different buffer size), or no small string optimization. They may also have different order of fields. Additionally, std::allocator that allocates std:;string by default from different implementations may use different arenas.

std::string_view is more likely to match, though there could be variations (two pointers or pointer and size). Debug versions may have some additional information.

Alex Guteniev
  • 12,039
  • 2
  • 34
  • 79