#ifndef LUAPB_H_ #define LUAPB_H_ extern "C" { #include "lua.h" #include "lualib.h" #include "lauxlib.h" } #include 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