在win32(xp、vista等)中将Lua绑定到Ada?
我发现只有一个公共库可以将 Lua 绑定到 Ada (http://coreland.ath. cx/code/lua-ada),但是如何在Windows平台上使用呢?我需要在 ada 项目中使用什么才能使项目文件中定义的 lua.ads.adb 库正常工作?
我尝试在编译之前将 lua 源代码放入我的 ada-project 目录中,但这没有任何作用 - GNAT 引发了一个错误,例如 undefined reference to
。
。
There is only one public library for binding Lua to Ada I have found (http://coreland.ath.cx/code/lua-ada), but how can it be used on a Windows platform? What do I need to use in my ada-project to get lua.ads.adb libraries defined in project-files working properly?
I tried to put lua sources in my ada-project directory befory compiling but that does nothing - GNAT raises an error like undefined reference to <c++ function>
.
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只有通过一次又一次的测试,我才找到了如何安全地绑定 Lua。
首先,将 Ada-Lua 包中的 lua-ext.c 和所有 Lua 源代码解压到主 Ada 项目目录。然后将 lua.c 重命名为 lual.c (或同等名称)以消除相同对象文件名的错误('lua.ads->lua.o | lua.c->lua.o')。最后一个是在GNAT中打开C编译器。可以通过“项目 - 编辑项目属性 - 语言”来完成。
这就是我为让我的 lua 文件与 Ada 程序一起工作所做的一切。
PS 要打开 Ada 程序中所有可用的 Lua 库,应调用这两个过程:
Only by testing and testing once more I found how to bind safely Lua.
First of all is to unpack lua-ext.c from Ada-Lua package and all Lua-sources to main Ada-project directory. Then renaming lua.c to lual.c (or something equal) to eliminate error with same object-file name ('lua.ads->lua.o | lua.c->lua.o'). The last one is to turn on C-compiler in GNAT. It could be done via "Project - Edit project properties - Languages".
That's all I made to have my lua-files work with Ada-program.
P.S. To turn on all available Lua-libraries in Ada-program should be called those two procedures:
Windows 似乎不在 Lua-Ada 支持的平台列表。尽管如此,这些绑定应该在某种程度上可以移植到其他 Gnat 平台。您需要获取 Windows Lua 库(很可能是 DLL)并以某种方式将两者移植在一起。
这是可行的——我曾经用 Clips 做过类似的事情。然而,任何执行此操作的人都需要(或变得)非常熟悉 C/C++ 链接器、Mingwin 对 Windows 库的支持(通常通过 DLL)以及 Ada 接口与 C 链接的工作方式。
Windows doesn't seem to be on Lua-Ada's list of supported platforms. Still, the bindings ought to be somewhat portable to other Gnat platforms. You would need to get hold of a Windows Lua library (most likely a DLL) and graft the two together somehow though.
It's doable - I did something similar with Clips once. However, anyone doing this is going to need to be (or become) quite conversant with the C/C++ linker, Mingwin's support for Windows libraries (typically through DLLs), and how Ada interfaces to C linkages work.