comp.lang.ada
 help / color / mirror / Atom feed
From: Warren <ve3wwg@gmail.com>
Subject: Re: Passing Ada Proc as a C Function Pointer
Date: Wed, 4 Aug 2010 17:24:09 -0700 (PDT)
Date: 2010-08-04T17:24:09-07:00	[thread overview]
Message-ID: <fd9e2234-0830-4964-adea-68ff6f6ed1ce@o19g2000yqb.googlegroups.com> (raw)
In-Reply-To: 18lgtff9nqvia.bxr7lzz8gk36.dlg@40tude.net

On Aug 4, 1:14 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Wed, 4 Aug 2010 09:40:29 -0700 (PDT), Warren wrote:
> > I some types defined as:
>
> >   type Thread_Context is private;
>
> pragma Convention (C, Thread_Context);

Let's not worry about the arguments. The WinAVR or even AVR-GCC
is very gnat specific.  System.Address is all I need where argument
pointers are required.

> > Because this part of the Ada code is not working, I'm suspicious that
> > the passed function pointer is incorrect (I have an all-C thread
> > example working).
>
> You have to pass a pointer to a procedure of C convention. You also must
> ensure that other parameters aren't passed by copy.

The only problem to be solved is the function pointer for the C
code (ignoring portability of course). The C side is going to
set up its stack and registers and then invoke the Ada side. I
have this working in pure C, but when I try to launch an Ada
thread, things seem to fall apart.

Warren



  reply	other threads:[~2010-08-05  0:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04 16:40 Passing Ada Proc as a C Function Pointer Warren
2010-08-04 17:14 ` Dmitry A. Kazakov
2010-08-05  0:24   ` Warren [this message]
2010-08-04 18:46 ` Jeffrey Carter
2010-08-04 19:36   ` Dmitry A. Kazakov
2010-08-05  0:42   ` Warren
2010-08-05  0:55     ` Warren
2010-08-04 19:46 ` Simon Wright
2010-08-05  0:45   ` Warren
2010-08-05  7:33     ` Rolf
2010-08-05 20:50       ` Simon Wright
  -- strict thread matches above, loose matches on Subject: below --
2010-08-05 14:31 Warren
2010-08-05 15:37 ` Warren
2010-08-05 16:51   ` Warren
replies disabled

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