You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.2 KiB
44 lines
1.2 KiB
|
|
#ifndef LUAPB_H_
|
|
#define LUAPB_H_
|
|
|
|
extern "C"
|
|
{
|
|
#include "lua.h"
|
|
#include "lualib.h"
|
|
#include "lauxlib.h"
|
|
}
|
|
|
|
#include <google/protobuf/message.h>
|
|
|
|
typedef struct tagluamsg
|
|
{
|
|
google::protobuf::Message* msg;
|
|
bool isDelete; //是否要释放掉这个msg;
|
|
}lua_pbmsg;
|
|
|
|
typedef struct tagluarepeatedmsg
|
|
{
|
|
google::protobuf::Message* msg;
|
|
google::protobuf::FieldDescriptor* field;
|
|
}lua_repeated_msg;
|
|
|
|
#define PB_MESSAGE "pb"
|
|
#define PB_MESSAGE_META "pb_meta"
|
|
|
|
#define PB_REPEATED_MESSAGE_META "pb_repeated_meta"
|
|
|
|
#ifdef _WIN32
|
|
extern "C" __declspec(dllexport) void luaopen_luapb(lua_State* L);
|
|
extern "C" __declspec(dllexport) int pb_import(lua_State* L);
|
|
extern "C" __declspec(dllexport) int pb_import_data(const char* filename, const void* data, int size);
|
|
extern "C" __declspec(dllexport) void * lua_decode(const void* data, int* size);
|
|
// extern "C" __declspec(dllexport) void freeData(void * data);
|
|
#else
|
|
extern "C" void luaopen_luapb(lua_State* L);
|
|
extern "C" int pb_import(lua_State* L);
|
|
extern "C" int pb_import_data(const char* filename, const void* data, int size);
|
|
extern "C" void * lua_decode(const void* data, int* size);
|
|
// extern "C" void freeData(void * data);
|
|
#endif
|
|
#endif
|
|
|