From: "James S. Rogers" <jimmaureenrogers@worldnet.att.net>
Subject: Re: C code to Ada
Date: Mon, 20 Jan 2003 22:56:15 GMT
Date: 2003-01-20T22:56:15+00:00 [thread overview]
Message-ID: <j8%W9.4814$zF6.411089@bgtnsc04-news.ops.worldnet.att.net> (raw)
In-Reply-To: e2_W9.3074$Ts5.30248@newsfep4-win.server.ntli.net
I looked in the GNAT file i-cstrea.ads. It defines the following
(just an excerpt from the file)
package Interfaces.C_Streams is
pragma Preelaborate;
-- Note: the reason we do not use the types that are in Interfaces.C is
-- that we want to avoid dragging in the code in this unit if possible.
subtype chars is System.Address;
-- Pointer to null-terminated array of characters
subtype FILEs is System.Address;
-- Corresponds to the C type FILE*
subtype voids is System.Address;
-- Corresponds to the C type void*
It appears that you can correctly use System.Address on to
bind to a C void*.
Jim Rogers
"chris.danx" <spamoff.danx@ntlworld.com> wrote in message
news:e2_W9.3074$Ts5.30248@newsfep4-win.server.ntli.net...
> sk wrote:
> > Hi,
> >
> > I had a binding (lost due to a misplaced "mkfs /dev/...")
>
> oops!
>
> > but I am not sure where you are getting the "__THROW"
> > from.
>
> from /usr/include/dlfcn.h
>
>
> > When I was playing with shared-libraries etc (based on the
> > Linux-Documentation-Project Program-Library-HOWTO), I did
> > "man dlopen" and bound to the functions specified
> >
> > From "man dlopen" ...
>
> Cheers will look at that!
>
>
> > #include <dlfcn.h>
> >
> > void *dlopen(const char *filename, int flag);
> >
> > So ...
> >
> > ICS => Interfaces.C.Strings;
> > IC => Interfaces.C;
> >
> > procedure Dlopen (
> > Name : ICS.Chars_Ptr; -- <= Assign with ICS.New_String
> > Mode : IC.Int
> > );
>
>
> I don't understand this. Why procedure? The return type of dlopen is
> not void (a procedure), but void* (a pointer to an unknown object -
> unknown to the client because dereferencing directly on void* isn't
> allowed; you have to cast it before you can dereference it). It's where
> you get the handle from and what's causing me the most problems.
>
>
> > procedure Dlsym (Handle : System.Address; Symbol : IC.Char_Array)
> >
> > function Dlclose return IC.Int;
> >
> > Translating
> > "(void)" typically translates to parameterless function/procedure
> > "void function-name" typically translates to an Ada procedure
>
> See above.
>
>
> > The best source I found dealing with dl* is in the above mentioned
> > howto. With some care, the special library functions "init"
> > and "fini" can be nicely related to "adainit" and "adafinal"
> > needed to make a stand-alone shared/dynamic library all using
> > Ada and GNAT :-)
>
> I don't understand but I'll look at this a little later.
>
>
> Thanks,
> Chris
> --
> for personal replies change spamoff to chris
>
next prev parent reply other threads:[~2003-01-20 22:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-20 18:44 C code to Ada chris.danx
2003-01-20 21:33 ` sk
2003-01-20 21:43 ` chris.danx
2003-01-20 22:56 ` James S. Rogers [this message]
2003-01-20 23:05 ` chris.danx
2003-01-21 2:17 ` Jeffrey Carter
2003-01-20 23:32 ` sk
2003-01-21 0:56 ` chris.danx
2003-01-21 1:26 ` sk
2003-01-21 15:49 ` Frank J. Lhota
2003-01-22 1:05 ` chris.danx
2003-01-21 2:27 ` Jeffrey Carter
2003-01-21 2:55 ` sk
2003-01-21 19:33 ` Jeffrey Carter
2003-01-21 6:18 ` Simon Wright
[not found] ` <3E2C6B2B.5090600@noname.com>
2003-01-20 21:39 ` sk
2003-01-21 1:23 ` sk
2003-01-25 21:28 ` chris.danx
2003-01-26 2:16 ` sk
2003-01-26 3:04 ` sk
[not found] ` <3E33502D.7030503@noname.com>
2003-01-26 5:37 ` sk
2003-01-23 8:00 ` sk
2003-01-24 18:03 ` chris.danx
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox