comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: Re: C code to Ada
Date: Mon, 20 Jan 2003 21:43:09 +0000
Date: 2003-01-20T21:43:09+00:00	[thread overview]
Message-ID: <e2_W9.3074$Ts5.30248@newsfep4-win.server.ntli.net> (raw)
In-Reply-To: <mailman.1.1043098229.4961.comp.lang.ada@ada.eu.org>

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




  reply	other threads:[~2003-01-20 21:43 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 [this message]
2003-01-20 22:56     ` James S. Rogers
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