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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,f5a3111843eb37e2,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!postnews.google.com!41g2000hsc.googlegroups.com!not-for-mail From: pfpearson.net@gmail.com Newsgroups: comp.lang.ada Subject: Questions on using prgma Import (C, foo) Date: Mon, 25 Feb 2008 11:22:07 -0800 (PST) Organization: http://groups.google.com Message-ID: <487a5f28-32d3-4bf6-921c-72c40c40b76e@41g2000hsc.googlegroups.com> NNTP-Posting-Host: 132.228.195.207 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1203967328 2617 127.0.0.1 (25 Feb 2008 19:22:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 25 Feb 2008 19:22:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 41g2000hsc.googlegroups.com; posting-host=132.228.195.207; posting-account=fdzthQoAAACMwPpBQYiXk93baqaXd0li User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20057 Date: 2008-02-25T11:22:07-08:00 List-Id: I'm writing some Ada bindings for lua ( http://www.lua.org/ ), a very small and fast interpreter with a clean C API. While I've been developing Ada for years, this is my first real foray into importing C libraries (I've done the occasional import of memcpy() or such). My question is how to handle C functions that return "char *". The Lua function is question is: const char *lua_tolstring (lua_State *L, int index, size_t *len); At first I just wrote this as: function lua_tolstring (L: lua_State_ptr; index: inteter; len : size_t_ptr) return Interfaces.C.Char_array; However, it only took me a minute to realize that this won't work. I see two options: 1. function lua_tolstring (...) return System.Adddress; 2. use the types declared in Interfaces.C.Strings. Has anyone else been down this path? If so, can you share your experiences? I've read the AARM, and done some Googling, and looked through the sources in Gnat. If you want me to RTFM, then please point me to the manual, and I will gladly read it! thanks!