comp.lang.ada
 help / color / mirror / Atom feed
* How to pass two dimensional arrays to C
@ 2006-07-28 11:06 Jerry
  2006-07-28 12:27 ` Jeffrey Creem
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: Jerry @ 2006-07-28 11:06 UTC (permalink / raw)


In my project to write a binding for a popular plotter written in C,
I've hit a brick wall and the problem might be associated with passing
two-dimensionaal arrays to C. I'm using GNAT on OS X and Xcode. I can
pass one-dimensional arrays OK. Here are the pertinent parts from an
example where the problem happens:


      The C


typedef double PLFLT;
typedef int PLINT;

void c_plmesh(PLFLT *x, PLFLT *y, PLFLT **z, PLINT nx, PLINT ny, PLINT
opt);



      The Ada


type Long_Float_Array_1D is array (Integer range <>) of Long_Float;
type Long_Float_Array_2D is array (Integer range <>, integer range <>)
of Long_Float;

subtype PLINT  is Integer;

subtype PL_Float_Array    is Long_Float_Array_1D;
subtype PL_Float_Array_2D is Long_Float_Array_2D;

procedure plmesh(
    x   : PL_Float_Array;
    y   : PL_Float_Array;
    z   : PL_Float_Array_2D;
    nx  : PLINT;
    ny  : PLINT;
    opt : PLINT);
pragma Import(C, plmesh, "c_plmesh");



      And the Ugly


AdaPLplotProject has exited due to signal 11 (SIGSEGV).

This appears during the call to plmesh. Any ideas? 

Thanks,
Jerry




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

end of thread, other threads:[~2006-08-14  6:59 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-28 11:06 How to pass two dimensional arrays to C Jerry
2006-07-28 12:27 ` Jeffrey Creem
2006-07-28 12:27 ` Dmitry A. Kazakov
2006-07-28 16:53 ` Adam Beneschan
2006-07-28 20:15 ` Jeffrey R. Carter
2006-07-28 20:46 ` Jerry
2006-07-28 21:14   ` Jeffrey Creem
2006-07-28 22:54   ` Björn Persson
2006-07-29  1:14     ` Jeffrey R. Carter
2006-07-29  7:11       ` Simon Wright
2006-07-29 22:12         ` Jeffrey R. Carter
2006-07-30 11:18           ` Simon Wright
2006-07-30 11:20           ` Simon Wright
2006-07-29  4:19   ` REH
2006-07-29  4:28     ` REH
2006-07-29  4:30       ` REH
2006-08-14  6:59     ` Dave Thompson
2006-07-29  5:47 ` REH
2006-08-02  8:20 ` Jerry
2006-08-02  9:03   ` Dmitry A. Kazakov
2006-08-02 10:22     ` Jerry
2006-08-02 18:25   ` Björn Persson
2006-08-05  1:03 ` Jerry

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