comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: skibochka@yahoo.com (Andrew Skiba)
Cc: comp.lang.ada@ada-france.org
Subject: Re: Problem with C function pointers
Date: 19 Dec 2003 21:07:13 -0500
Date: 2003-12-19T21:07:13-05:00	[thread overview]
Message-ID: <mailman.147.1071886047.31149.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <963c4dec.0312191413.15c9cb08@posting.google.com>

skibochka@yahoo.com (Andrew Skiba) writes:

> The question is how do I eliminate the check? 

You don't want to eliminate the check! but you do want to solve the
problem. 

> type SetCooperativeLevel_func is access function
> (thiz:IDirectFBCore_ptr; level:CooperativeLevel) return DFBResult;
> pragma Convention (C, SetCooperativeLevel_func); -- this does not help
> type IDirectFBCore is record
>   ...
>   SetCooperativeLevel:SetCooperativeLevel_func; -- this field
>     -- points to some C function inside DirectFB library
>   ...
> end record;
> pragma Convention (C, IDirectFBCore); -- this does not help, too :-(
> thiz:IDirectFBCore;
> f:SetCooperativeLevel_func;
> 
> f:=thiz.SetCooperativeLevel; -- here exception is raised

Hmm. At this point "thiz" has the value "null". What do you expect?

I suspect you left out some code, that sets "thiz". please post a
small compilable example, if possible.

Have you tried running under gdb, and examining "thiz"?

Just out of curiosity, what does DirectFB do?
-- 
-- Stephe




  reply	other threads:[~2003-12-20  2:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-19 22:13 Problem with C function pointers Andrew Skiba
2003-12-20  2:07 ` Stephen Leake [this message]
2003-12-21 13:06   ` Andrew Skiba
2003-12-21 14:04     ` Stephen Leake
2003-12-22  9:37       ` Andrew Skiba
2003-12-22 23:10         ` Stephen Leake
2003-12-23 16:04           ` Ad Buijsen
replies disabled

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