comp.lang.ada
 help / color / mirror / Atom feed
* Interface to C; Storage_Error
@ 2000-12-19 22:28 Chris
  2000-12-20  3:52 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Chris @ 2000-12-19 22:28 UTC (permalink / raw)


Hi, all... after a long hiatus in the C++ world, I'm finally getting a
chance to do some more Ada work, at my own suggestion. The ability to
write production-quality multithread code an order of magnitude faster
in Ada might have something to do with it.

Anyway, I'm having an irritating problem interfacing with a vendor C
library. The relevant stuff:

  typedef void* SRV_HANDLE;
  typedef void* CTX_HANDLE;
  typedef void* RSLT_HANDLE;
  typedef void* FLT_HANDLE;

   int GetNextVal(SRV_HANDLE srv, RSLT_HANDLE rslt, CTX_HANDLE *ctx,
                  char* name, double* dbl, FLT_HANDLE flt);

My take on it in Ada (GNAT 3.13p) is:

   type Srv_Handle is new System.Address;
   -- same for the other handles

   procedure GetNextVal(Ret  : out int;
                        Srv  : Srv_Handle;
                        Rslt : Rslt_Handle;
                        Ctx  : access Ctx_Handle;
                        Name : out chars_ptr;
                        Dbl  : access double;
                        Flt : Flt_Handle);
   pragma Import(C, GetNextVal);
   pragma Import_Valued_Procedure(GetNextVal);

Both Name and Dbl are supposedly set/alloc'd by the library. When I
call this, it raises Storage_Error on the library call. I am totally
stumped as to what to fix, or even where to look. Is my Ada declaration
even remotely correct?
Other suggestions?


Many thanks.

--chris


Sent via Deja.com
http://www.deja.com/



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2000-12-23  2:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-19 22:28 Interface to C; Storage_Error Chris
2000-12-20  3:52 ` Ted Dennison
2000-12-20  8:55   ` Robert Dewar
2000-12-20 11:39 ` Thomas Wolf
2000-12-20 17:05   ` Chris
2000-12-20 23:57     ` Chris
2000-12-21 15:35       ` Thomas Wolf
2000-12-21 18:07         ` Chris
2000-12-21  3:25 ` DuckE
2000-12-21 11:38   ` Robert Dewar
2000-12-23  2:45     ` DuckE

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