From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,9939161a73e5f223,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.224.218.2 with SMTP id ho2mr25923035qab.8.1357152373674; Wed, 02 Jan 2013 10:46:13 -0800 (PST) Received: by 10.49.116.139 with SMTP id jw11mr7405962qeb.12.1357152373658; Wed, 02 Jan 2013 10:46:13 -0800 (PST) Path: k2ni4226qap.0!nntp.google.com!ee4no12045221qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 2 Jan 2013 10:46:13 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=70.53.16.242; posting-account=cUi90woAAADTaOISowbbHM8GUD0-opJO NNTP-Posting-Host: 70.53.16.242 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <38857635-8ab5-4ff6-b547-f40ac31720a2@googlegroups.com> Subject: Please help with my lua binding From: Patrick Injection-Date: Wed, 02 Jan 2013 18:46:13 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-01-02T10:46:13-08:00 List-Id: Hello Everyone I am trying to make a binding to Lua. Although I had to comment out a couple of functions, I have three compiling spec files for the three lua headers that are needed to form a binding. I have a great free pascal binding to use as an example I used fdump-ada-spec-slim and it helped a lot. I was able to sort out most of the types and macros by hand. In lua, lua_State holds the instance of lua. It is an empty struct in the header and fdump skips it. I don't really know how to represent this structure in lua. I tried to define it as: type lua_State is access lua_State; pragma Import (C, lua_State, "lua_State"); but when I call it in this piece of code: with lauxlib_h ; use lauxlib_h ; with lualib_h ; use lualib_h ; with lua_h ; use lua_h ; procedure test is result : Integer ; type L is access lua_State ; begin L := luaL_newstate ; end test ; I get this: test.adb:27:01: invalid use of subtype mark in expression or call lua_h.ads:149:26: type "lua_State" cannot be used before end of its declaration lua_h.ads:150:19: second argument of pragma "import" must be object or subprogram gnatmake: "test.adb" compilation error In the pascal biding lua_State is: Plua_State = Pointer; They put a P at the start to show it is a pointer. An example of it's use in C is: int main(void) { lua_State *L; L = luaL_newstate(); /* Create Lua state variable */ luaL_openlibs(L); /* Load Lua libraries */ continues.... interfaces.C helps me a lot but outside of it I get mixed up working with C. Does anyone have any hints on how I could define lua_State in my spec file? Thanks for reading.