Skip to content

Can i access C #define's in nelua code? #128

Answered by edubart
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

Is that looking for a variable named as _WIN32 in the nelua pre-processor code?

When you use an if statement in the preprocessor, it will look for a variable in the preprocessor's Lua environment, and _WIN32 is not defined there, unless you define it (by doing _WIN32 = true before the if).

Does it also look in the GCC/OS?

No, the Nelua's preprocessor does not make any define from the C preprocessor visible, but some from the C compiler are converted to values you can find in ccinfo, so you can do if ccinfo.is_windows then to check for Windows, under the hood this will be true in the C compiler also defines _WIN32, and it's an effective way to detect windows.

Can I access C #define's …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ghost
Comment options

Answer selected by edubart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant