Skip to content

Commit

Permalink
fix: fix plugin load failed
Browse files Browse the repository at this point in the history
  • Loading branch information
engsr6982 committed Dec 21, 2024
1 parent f4bb633 commit 4af1470
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
14 changes: 8 additions & 6 deletions src/Entry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <thread>
#include <utility>

#if defined(WIN32) && defined(DEBUG)
#if (defined(WIN32) || defined(_WIN32)) && defined(DEBUG)
#include <debugapi.h>
#endif

Expand All @@ -20,7 +20,7 @@ Entry* Entry::getInstance() {
}

void Entry::onLoad() {
#if defined(WIN32) && defined(DEBUG)
#if (defined(WIN32) || defined(_WIN32)) && defined(DEBUG)
getLogger().setLevel(endstone::Logger::Debug);
getLogger().info("Waiting for VC debugger attach...");
while (!IsDebuggerPresent()) {
Expand Down Expand Up @@ -56,8 +56,10 @@ endstone::PluginDescription const& Entry::getDescription() const { return descri

} // namespace jse

#if defined(_WIN32)
extern "C" __declspec(dllexport) endstone::Plugin* init_endstone_plugin() { return jse::Entry::getInstance(); }
else
extern "C" __attribute__((visibility("default"))) endstone::Plugin* init_endstone_plugin() { return jse::Entry::getInstance(); }

#if defined(WIN32) || defined(_WIN32)
#define EXPORT_ENTRY_POINT __declspec(dllexport)
#else
#define EXPORT_ENTRY_POINT __attribute__((visibility("default")))
#endif
extern "C" [[maybe_unused]] EXPORT_ENTRY_POINT endstone::Plugin* init_endstone_plugin() { return jse::Entry::getInstance(); }
Binary file modified third-party/quickjs/linux/lib/quickjs.a
Binary file not shown.
5 changes: 2 additions & 3 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ target("Js_Engine")
)
elseif is_plat("linux") then
add_includedirs("./third-party/quickjs/linux/include")
add_ldflags("-Wl,--whole-archive ./third-party/quickjs/linux/lib/quickjs.a -Wl,--no-whole-archive", {force = true})
add_files("./third-party/quickjs/linux/lib/quickjs.a")

add_links("third-party/quickjs/linux/lib/quickjs.a")

add_cxflags(
"-fPIC",
"-stdlib=libc++",
Expand Down

0 comments on commit 4af1470

Please sign in to comment.