libcmini icon indicating copy to clipboard operation
libcmini copied to clipboard

wrap declaration inside extern "C"

Open StephaneCapo opened this issue 10 months ago • 2 comments

Hello,

it should be useful to set declarations in headers files between : 

#ifdef __cplusplus extern "C" { #endif

// declarations

#ifdef __cplusplus } // extern "C" #endif

so that including those headers in a C++ project will work directly.

StephaneCapo avatar May 11 '25 13:05 StephaneCapo

Could be done, but using libcmini in a c++ project may be a bad idea. There are way to many assumptions in c++ libraries about the underlying c-library being posix-conformant, which is not the case for libcmini. There will also be quite some unresolved external, i guess.

th-otto avatar May 11 '25 13:05 th-otto

Thanks for your answer. Probably I don't use a lot of the C++ features (no new / delete or virtual methods for example), but templates, std::array, member methods on classes ... At the moment, I compile C++ code setting the libcmini #includes inside an extern "C" block and it's fine, so it's not really an issue as this workaround is OK.

StephaneCapo avatar May 11 '25 14:05 StephaneCapo