[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re[2]: about the final version
- From: Paul_Winwood@...
- Date: Thu, 12 Oct 2000 08:56:16 GMT
>>A (very) late change request, but only a clerical change. Could all API
>>functions be identified as such in header and code with a macro such as
>>LUA_API_FUNCTION, so that those of us who would like to build Lua as a
>>Windows DLL can do so easily?
In order to build LUA as a DLL requires that the functions be marked as
exported.
The is achieved by adding a '__declspec(dllexport)' prefix on all public
functions
that are to be exported. Therefore if in the lua header file LUA_API_FUNCTION
was defined as follows:
#ifndef LUA_API_FUNCTION
#define LUA_API_FUNCTION
#endif
and all public functions and function defintitions were prefixed with
LUA_API_FUNCTION, then if someone wants to build Lua as a DLL,
they just have define LUA_API_FUNCTION as
#define LUA_API_FUNCTION extern __declspec(dllexport) [...]
(this could also be defined on the command line to the compiler).
>Some time ago, I posted to the list a Lua script for adding __stdcall
>to the code. I think this is needed for using a Windows DLL in Visual Basic.
>This script is now included in the distribution.
There is no need to add __stdcall to the code because for the Microsoft compiler
there is a '-Gz' command line compiler option which makes all functions not
explicitly defined otherwise __stdcall. For the Borland compiler the equivalent
command line compiler option is '-ps'. I assume other Windows compilers that
support __stdcall have a similar compiler option.
--Paul.