Lua alien windows




















To get the value of errno with Alien call alien. Some libraries have functions that take callbacks , functions that get called by the library. Most GUI libraries use callbacks, but even the C library has qsort. Alien lets you create a callback from a Lua function with alien.

You pass the function and the callback prototype that the library expects. Alien will return a callback object that you can pass in any argument of callback type. A simple example, using qsort :. Callbacks are callable from Lua just like any other Alien function, and you can freely change their types with their "types" method.

C libraries are full of symbolic constants that are in truth magic numbers, as they are replaced by the preprocessor before even the C compiler has a chance to see them. This means that all these constants are on header files. This also includes things such as the layout and size of structures the library depends on.

All this information can change from version to version of the library, or from platform to platform. Alien provides a utility script called constants that makes it easier to work with these numbers. This utility takes three arguments on the command line: a definitions file , the name of the C file you want it to generate, and the name of a Lua file that the C file will generate when compiled and run.

It is best to explain by example from a libevent binding :. Lines with preprocessor directives are copied verbatim to the C file constants generates.

The above definitions file generates this C file:. These steps generating the C file, compiling, generating the Lua file are best done in the build step of your extension.

You can query what platform your extension is running on with alien. Currently this can be one of "linux", "bsd", "darwin" or "windows".

Other platforms will be added as they are tested. You can use this information for conditional execution in your extensions. You can get the sizes of the types Alien supports using alien. You can also get structure aligment information with alien. Alien is designed and implemented by Fabio Mascarenhas. It uses the great libffi library by Anthony Green and others to do the heavy lifting of calling to and from C.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Skip to content. Star Permalink master. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 8 years, 5 months ago.

Active 7 years, 10 months ago. Viewed 1k times. Improve this question. Very helpful! Any hints or help would be useful. Sorry, something went wrong.

The problem was that libffi. Once I put that in there it worked. Skip to content. Star New issue. Jump to bottom. Changed the 'lualibs' to 'lua' to support the default locations. Updated SciTE property file to make the help show up correctly.

Updated Stdlib to version 8. Updated the quickluatour. Updated the luaforwindows document. Fixed LuaInterface module. Added lpack 29 Jun module. Added VStruct v 1. Added BitLib release 25 module. Added LuaXML v1. Updated IUP to version 2. Updated CD to version 5. Updated IM to version 3. Fixed a SciTE bug when opening the Lua manual. Added lExecutor. Added 'wildcard'. Associated 'wildcard'. Added LuaBitOp v1. Fixed a bug in lExecutor to properly pass file loading error to the user.

Fixed LuaDoc templates a bit for 'tables' and 'functions'. LuaXML so it actually works. Updated Copas to version 1. Removed BitLib. Use LuaBitOp instead. Added MetaLua v0. Added the 'strict. Added Lanes v2. Updated LuaFileSystem to version 1. Updated the Lua executables so they run on Windows 64 5. Added a link to the lExecutor documentation in the start menu. Now you can launch quickluatour. Fixed SciTE saving a debugger file to the current running scripts directory.

Now it saves it to your local temp directory. Fixed SciTE toolbar icons being incorrect. Fixed debugging files with spaces in the filename. Made SciTE use the lua5. Changed the version number to use a '-' as a build number of the LfW package. Changed the installer display name to 'Lua For Windows'. Updated Stdlib to version Updated LuaCOM to version 1.



0コメント

  • 1000 / 1000