Skip to content

Conversation

@RinatNamazov
Copy link
Contributor

Fixes "undefined reference" error if LuaJIT is built with FFI disabled.

@ThePhD
Copy link
Owner

ThePhD commented May 13, 2021

Hey, thanks for the patch!

Typically, what we do is we create a special macro post-fixed with _I_ that sits in the version.hpp file. That special macro is "internal", and is triggered by build-based defines. Because this one comes from LuaJIT, you might need to add it to the compatibility.hpp file where a few other configuration defines are put in.

The reason we do this is to allow the user to manually specify it, if they want to. If the user doesn't, then it falls back to default logic. After that, we use the value produced there in the checks in the real code, so it'd be

#if SOL_IS_ON(SOL_USE_LUAJIT_I_) && SOL_IS_OFF(SOL_LUAJIT_FFI_DISABLED_I_)

@ThePhD ThePhD merged commit f535539 into ThePhD:develop May 16, 2021
@ThePhD
Copy link
Owner

ThePhD commented May 16, 2021

Beautiful, thank you so much!

512

@vdweller84
Copy link

Single header seems to be missing this. I patched it using

		#ifndef SOL_LUAJIT_FFI_DISABLED
						luaL_requiref(L, "ffi", luaopen_ffi, 1);
						lua_pop(L, 1);
		#endif

Let me know if anything will blow up doing this.

@ThePhD
Copy link
Owner

ThePhD commented Jun 25, 2022

That honestly looks okay to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants