dep-sol2/examples/require_dll_example/include/my_object/my_object.hpp
ThePhD 8618e39486
🛠 Prepare for the a sol4 release...
- 🎨 Refactor the CMake a whle bunch
2021-03-06 01:03:23 -05:00

29 lines
670 B
C++

#pragma once
#include <my_object/my_object_api.hpp>
// forward declare as a C struct
// so a pointer to lua_State can be part of a signature
extern "C" {
struct lua_State;
}
// you can replace the above if you're fine with including
// <sol.hpp> earlier than absolutely necessary
namespace my_object {
struct test {
int value;
test() = default;
test(int val) : value(val) {
}
};
} // namespace my_object
// this function needs to be exported from your
// dll. "extern 'C'" should do the trick, but
// we're including platform-specific stuff here to help
// see my_object_api.hpp for details
extern "C" MY_OBJECT_API int luaopen_my_object(lua_State* L);