Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent extern "C" propagation #933

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ if(LUAU_EXTERN_C)
# enable extern "C" for VM (lua.h, lualib.h) and Compiler (luacode.h) to make Luau friendlier to use from non-C++ languages
# note that we enable LUA_USE_LONGJMP=1 as well; otherwise functions like luaL_error will throw C++ exceptions, which can't be done from extern "C" functions
target_compile_definitions(Luau.VM PUBLIC LUA_USE_LONGJMP=1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unsure about if this should also be made private.

There doesn't appear to be anything in the header that makes use of it and a consumer may want to know about this.

target_compile_definitions(Luau.VM PUBLIC LUA_API=extern\"C\")
target_compile_definitions(Luau.Compiler PUBLIC LUACODE_API=extern\"C\")
target_compile_definitions(Luau.VM PRIVATE LUA_API=extern\"C\")
target_compile_definitions(Luau.Compiler PRIVATE LUACODE_API=extern\"C\")
endif()

if(LUAU_NATIVE)
target_compile_definitions(Luau.VM PUBLIC LUA_CUSTOM_EXECUTION=1)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other

if(LUAU_EXTERN_C)
target_compile_definitions(Luau.CodeGen PUBLIC LUACODEGEN_API=extern\"C\")
target_compile_definitions(Luau.CodeGen PRIVATE LUACODEGEN_API=extern\"C\")
endif()
endif()

Expand Down