Merge pull request #53 from AuroraTea/master
fix: compatibility of C and C++
This commit is contained in:
0
C/source/.gitignore → C/.gitignore
vendored
0
C/source/.gitignore → C/.gitignore
vendored
@@ -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
|
||||
|
||||
@@ -34,5 +34,13 @@ typedef struct IdGenOptions {
|
||||
|
||||
} IdGeneratorOptions;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern IdGeneratorOptions BuildIdGenOptions(uint32_t workerId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include <unistd.h>
|
||||
#include "IdGenerator.h"
|
||||
|
||||
static IdGenerator *_idGenerator = NULL;
|
||||
|
||||
static inline uint64_t WorkerM1Id()
|
||||
{
|
||||
return WorkerM1NextId(_idGenerator->Worker);
|
||||
|
||||
@@ -21,10 +21,6 @@ typedef struct IdGenerator {
|
||||
|
||||
} IdGenerator;
|
||||
|
||||
|
||||
static IdGenerator *_idGenerator = NULL;
|
||||
|
||||
extern IdGenerator *GetIdGenInstance();
|
||||
|
||||
extern void SetOptions(IdGeneratorOptions options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user