Skip to content

Conversation

@Jan200101
Copy link
Contributor

@Jan200101 Jan200101 commented Sep 30, 2025

same as #933 but using generator expression which can be used since the project upgraded to cmake 3.10.

This seems to work flawlessly but there are likely some edge cases I did not consider, similar to #933.

Without this PR there are a lot of errors due to extern "C"not being valid in C:

luau-src/VM/include/lua.h:109:1: note: in expansion of macro ‘LUA_API’
  109 | LUA_API lua_State* lua_newstate(lua_Alloc f, void* ud);
      | ^~~~~~~

https://github.com/Jan200101/luau-c-test test repo that prints the _VERSION value in C and C++, the luau repo is commented out in the CMakeLists.txt but can be re-enabled to see the error that would happen without this PR.

@mihaly-sisak
Copy link

mihaly-sisak commented Oct 4, 2025

Tried on my mixed C/C++ project, works flawlessly, gets rid of ugly workarounds.
https://github.com/mihaly-sisak/luau_torch7/blob/master/torch7/torch7.h#L4
Would love to see this merged!

@aatxe aatxe requested a review from vegorov-rbx October 8, 2025 18:42
@mihaly-sisak
Copy link

Could this please be merged when you get the chance? It’s a really solid contribution and would be great to have in.

Thank you all for the incredible work you’re doing on this project. It’s always impressive to see the level of care and quality that goes into everything.

`extern "C"` is only valid in C++, other languages may incorrectly
interpret it or outright fail compilation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants