libsrtp icon indicating copy to clipboard operation
libsrtp copied to clipboard

Linking SRTP from C++ in MSVC

Open mghabboun opened this issue 12 years ago • 1 comments

I found a problem when linking from C++ application with libsrtp ( I don't know if it's categorized as a problem), the default config #define inline as blank, this is due to MSVC lack of C99 support while C89 doesn't have it. It works fine with C applications. Once you link from C++, it will violate one definition rule. My work around was to define inline __inline; this way the C++ will have no problem linking to the C library.

A better solution would be to include a pre-processor

if defined(MSVC) && defined(__cplusplus) #define inline _inline

I hope someone finds this useful.

mghabboun avatar Mar 03 '14 14:03 mghabboun

Thanks for reporting this. I don't have a MSVC setup to try this myself and test it properly. Otherwise I could incorporate this change into the library. If you want to submit a pull request with the fix, we can accept a patch as long as it doesn't break anything.

jfigus avatar Oct 08 '14 18:10 jfigus