You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now it is to my understanding the LUA_API and LUALIB_API are macros to help aid in the exporting of methods you would likely use. This is extremely handy for say disabling name managing via extern C and exporting in dynamic libraries via declspec to improve interop with other languages without modifying the source code tediously too much.
In most cases this does fine however declspec specifically can only go on method declarations and can't go on definitions with bodies which will cause a C2491 compile error. The main culprit of this seems to be the built-in libraries using LUALIB_API ,luaopen_math being a prime example here.
These macros should only exist on method declarations to make interop more seamless.
The text was updated successfully, but these errors were encountered:
These macros are only supposed to be used in header files; the fact that they are used in the source files is an oversight (LUA_API isn't for example). So it should be sufficient to remove the _API macros from sources.
KaleidoDeer
changed the title
Separate built-in library definition and declaration for public APIs
Remove LUALIB_API from method definitions
Nov 22, 2021
These macros are only supposed to be used in header files; the fact that they are used in the source files is an oversight (LUA_API isn't for example). So it should be sufficient to remove the _API macros from sources.
Ah yeah I didn't look closely enough in the header to see the declarations are already separate there. I'll modify the issue to be more clear, I'll have a PR to fix this tonight since it's safe to remove.
Now it is to my understanding the LUA_API and LUALIB_API are macros to help aid in the exporting of methods you would likely use. This is extremely handy for say disabling name managing via extern C and exporting in dynamic libraries via declspec to improve interop with other languages without modifying the source code tediously too much.
In most cases this does fine however declspec specifically can only go on method declarations and can't go on definitions with bodies which will cause a C2491 compile error. The main culprit of this seems to be the built-in libraries using LUALIB_API ,luaopen_math being a prime example here.
These macros should only exist on method declarations to make interop more seamless.
The text was updated successfully, but these errors were encountered: