From: fd@piau ()
Subject: Re: Help with ADA and C function pointers.
Date: 1996/11/26
Date: 1996-11-26T00:00:00+00:00 [thread overview]
Message-ID: <57eigc$6ce@news.cict.fr> (raw)
In-Reply-To: 32937F73.65A8@rsa.hisd.harris.com
Wendell P Beckwith (wbeckwit@rsa.hisd.harris.com) wrote:
: I have an ada main procedure which needs to pass the address of an ada
: function to a C funciton. Using gnat 3.05 the following compiles and
: generates an executable, but it cores when you run it. I knew it would
: because no where am I assigning a function to be passed. That is what
: I'd like to know how to do. Please respond to my work email, since I'm
: not in this group alot. Thanks!!
: Wendell
: -- my test main
: with Text_IO, Interfaces.C;
: use Text_IO;
: Procedure Gmain is
: Function func(d : in Integer) return Integer is
: Begin
: return (2 * d);
: End;
: type func_type is access Function(d : in Integer) return Integer;
: funcptr : func_type;
Here funcptr value is NULL
:
: Procedure Stuff(f : in func_type);
: pragma Import(C, Stuff, "stuff");
:
: Begin
: Stuff(funcptr);
there is a problem, funcptr is still equal to NULL
I will try Stuff(func'adress) and you don't need funcptr.
Hope it will help.
: End;
: -- my test C function using the ada callback
: #include <stdio.h>
: void stuff(int (*function)(int))
: {
: printf("Value = %d\n", (*function)(10));
: }
franck.duluc@avions.aerospatiale.fr
Regards.
prev parent reply other threads:[~1996-11-26 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-20 0:00 Help with ADA and C function pointers Wendell P Beckwith
1996-11-21 0:00 ` Aaron Quantz
1996-11-22 0:00 ` THANKS! (was Help with ADA and C function pointers.) Wendell P Beckwith
1996-11-22 0:00 ` Help with ADA and C function pointers Stephen Leake
1996-11-26 0:00 ` fd
1996-11-26 0:00 ` fd [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox