FFI question: Setting array elements 
Author Message
 FFI question: Setting array elements

Hi,

I have a question about the Functional Developer C FFI.  How do I go
about setting an element in an array that is in a struct?

define C-struct <Foo>
  array slot bar :: <C-unsigned-int>, length: 10;
  pointer-type-name: <Foo*>;
end;

begin
  with-stack-structure(f :: <Foo*>)
    //How do I set an element of f.bar, say the fifth element?
  end;
end;

thanks in advance!

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 07 Jan 2003 03:00:00 GMT  
 FFI question: Setting array elements
Try:

  with-stack-structure(f :: <Foo*>)
    bar(f, 5) := 0;
  end;

I think :-)

Chris.
--
http://www.double.co.nz/dylan



Wed, 08 Jan 2003 03:00:00 GMT  
 FFI question: Setting array elements


Quote:
> Try:

>   with-stack-structure(f :: <Foo*>)
>     bar(f, 5) := 0;
>   end;

Thanks, Chris.  You are correct.  I worked it out independently by the
error messages.

I hope that documentation on this subject is added to the Functional
Developer FFI docs for the benefit of new users.

Sent via Deja.com http://www.deja.com/
Before you buy.



Fri, 10 Jan 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Shifting array element & regex on array element

2. setting property of each element in an array

3. The set of specialized array element types must be closed under intersection

4. Cannot set env array element via upvar #0

5. BUG: array traces and setting elements via upvar

6. Arrays: Build array in multiple for loops or replace array elements

7. Adding an element in an array of cluster of 2 elements

8. Novice Question - Array Elements

9. array element (matrix) question

10. question about one-element arrays

11. Access Array Elements by Arrays Reference

12. for every element of array find bounds in another array

 

 
Powered by phpBB® Forum Software