Can I make the function `extern 'c" `?

I have some cpp files and I want to combine them with LuaJit using FFI.

But the problem is that I have to add extern "c" characters for almost every function so that FFI can get them.

Is there an easier way to do this?

+5
source share
1 answer

Several functions can be placed inside one extern "C" block. This allows you to type extern "C" only once for each header file.

 extern "C" { void function1(); void function2(); } 
0
source

All Articles