comp.lang.ada
 help / color / mirror / Atom feed
From: pfpearson.net@gmail.com
Subject: Questions on using prgma Import (C, foo)
Date: Mon, 25 Feb 2008 11:22:07 -0800 (PST)
Date: 2008-02-25T11:22:07-08:00	[thread overview]
Message-ID: <487a5f28-32d3-4bf6-921c-72c40c40b76e@41g2000hsc.googlegroups.com> (raw)

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!



             reply	other threads:[~2008-02-25 19:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-25 19:22 pfpearson.net [this message]
2008-02-25 19:28 ` Questions on using prgma Import (C, foo) Pascal Obry
2008-02-25 19:48   ` pfpearson.net
2008-02-26 12:15     ` Jeffrey Creem
2008-02-26 13:50     ` Stephen Leake
2008-02-26 19:59       ` pfpearson.net
2008-02-26 10:51 ` Jean-Pierre Rosen
2008-02-26 20:01   ` pfpearson.net
2008-03-10 20:29     ` Alexey Veselovsky
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox