lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

>> I notice that Lua (and many other open source projects) prefix their
>> function prototypes with an "extern" -- is this absolutely necessary?
>> What compilers/platforms won't link properly if this is missing?
>It's ANSI C.  Many many compilers won't handle it right without the
>extern, including GCC with certain options enabled.

Actually, "extern" was added as the default value of LUA_API. LUA_API was
introduced in Lua 4.0 by popular demand so that it was easy to introduce
special syntax for Windows DLLs. Up to Lua 3.2, there was no "extern" in lua.h,
and it compiled fine in all known platforms.  But it doesn't hurt either.