Wrapping C++ class API for C consumption

后端 未结 6 1421
滥情空心
滥情空心 2020-12-02 08:07

I have a set of related C++ classes which must be wrapped and exported from a DLL in such a way that it can be easily consumed by C / FFI libraries. I\'m looking for some \"

6条回答
  •  情书的邮戳
    2020-12-02 08:47

    Use vector (and string::c_str) to exchange data with non C++ APIs. (Guideline #78 from C++ Coding Standards, H. Sutter/ A. Alexandrescu).

    PS It's not that true that "constructors can retain their original argument list". This is only true for argument types which are C-compatible.

    PS2 Of course, listen to Cătălin and keep your interface as small and simple as possible.

提交回复
热议问题