1
0
mirror of synced 2025-11-06 03:20:55 +08:00

Merge pull request #53 from AuroraTea/master

fix: compatibility of C and C++
This commit is contained in:
yitter
2023-01-29 15:16:01 +08:00
committed by GitHub
5 changed files with 17 additions and 4 deletions

View File

View File

@@ -7,6 +7,10 @@
#include "idgen/IdGenOptions.h"
#include "idgen/common.h"
#ifdef __cplusplus
extern "C"
{
#endif
TAP_DLLEXPORT
extern void TAP_STDCALL SetIdGenerator(IdGeneratorOptions options);
@@ -17,3 +21,6 @@ extern void TAP_STDCALL SetWorkerId(uint32_t workerId);
TAP_DLLEXPORT
extern int64_t TAP_STDCALL NextId();
#ifdef __cplusplus
}
#endif

View File

@@ -34,5 +34,13 @@ typedef struct IdGenOptions {
} IdGeneratorOptions;
#ifdef __cplusplus
extern "C"
{
#endif
extern IdGeneratorOptions BuildIdGenOptions(uint32_t workerId);
#ifdef __cplusplus
}
#endif

View File

@@ -9,6 +9,8 @@
#include <unistd.h>
#include "IdGenerator.h"
static IdGenerator *_idGenerator = NULL;
static inline uint64_t WorkerM1Id()
{
return WorkerM1NextId(_idGenerator->Worker);

View File

@@ -21,10 +21,6 @@ typedef struct IdGenerator {
} IdGenerator;
static IdGenerator *_idGenerator = NULL;
extern IdGenerator *GetIdGenInstance();
extern void SetOptions(IdGeneratorOptions options);