vendredi 16 octobre 2020

stdint header for functions exported from dll

I have a header for exporting some methods from a DLL which can be used both from C and C++ code:

#ifdef __cplusplus
extern "C"
 {
#endif

    API_EXPORT uint32_t __cdecl GetSomeValue();

#ifdef __cplusplus
 }
#endif

and for uint32_t, I need to include a header, but which one is correct?

Option 1: <stdint.h>

#ifdef __cplusplus
extern "C"
{
#endif

#include <stdint.h>

Option 2:

#ifdef __cplusplus
extern "C"
{
#endif

#include <cstdint>

Option 3: both.

#ifdef __cplusplus
extern "C"
{
#include <cstdint>
#else
#include <stdint.h>
#endif

Aucun commentaire:

Enregistrer un commentaire