Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2005-07

Two-dimensional dynamic arrays in C libraries

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Silvio a Beccara

Hi everybody,

I need to pass two- or three-dimensional dynamic arrays to C libraries from FPC. I know this is feasible with one-dimensional arrays, by using a pointer to the array: for instance

---code
type
PDouble = ^Double;
function get_array(a, b: PDouble; size: integer; value: double):
integer; cdecl; external 'mylib.dll';
qq := get_array(PDouble(mat1),PDouble(mat2),kk,3.14);

---end code

but it doesn't seem to work with more dimensions. How could I do? Thanks, best regards

Silvio a Beccara

Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Vuoi bere tanta acqua pura e risparmiare ben 495 euro all'anno? * Con BeviSano avrai finito di comprare acqua in bottiglia - clicca qui Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=3628&d=15-7

Reply by email

Michael Van Canneyt
to Silvio a Beccara
Silvio a Beccara wrote 18 lines
Hi everybody, I need to pass two- or three-dimensional dynamic arrays to C libraries from FPC. I know this is feasible with one-dimensional arrays, by using a pointer to the array: for instance ---code type PDouble = ^Double; function get_array(a, b: PDouble; size: integer; value: double): integer; cdecl; external 'mylib.dll'; qq := get_array(PDouble(mat1),PDouble(mat2),kk,3.14); ---end code but it doesn't seem to work with more dimensions. How could I do?

You'll have to be more specific. Do you know the C interface, or do you have to make the C interface ?

Michael.

Reply by email