More external C 
Author Message
 More external C

  Hi,

I'm trying more external C stuff using poplog. I'm now trying to have a
C function return a pointer to a simple struct which I will use to
access the elements of the struct in poplog.

The C code is as follows
struct callback{
  long classHandle;
  long objectHandle;

Quote:
};

callback* foo(int x)
{
  callback* y;
  y->classHandle=(long)x+1;
  y->objectHandle=(long)x+1;
  return y;

Quote:
}

I'm trying to return a structure containing two longs, the poplog code I
have so far...
------
p_typespec callback {
                  classHandle :long,
                  objectHandle :long
                   };

defexacc: callback;

exload libtest [libtest]
foo(x) :exptr.{:callback} <-'foo__Fi'
endexload;
------

The typespec as I understand it creates a new type (callback). The
exload syntax I'm trying to achieve is to return a pointer to a "callback".

Is this code correct or is there something more I need to do? The
defexacc call should create access procedures 'classHandle' and
'objectHandle'
How do I then call 'exacc foo(3)->x' and get/change the values of
'classHandle' and 'objectHandle' for x?

--
Mike


http://www.*-*-*.com/ ~mhl/ < http://www.*-*-*.com/ %7Emhl/>



Fri, 08 Oct 2004 21:51:16 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. to CS: or not to CS: in F-PC assembler

2. External link errors when using external Catalyst SocketTools Library Edition 2.15 dll

3. Camp Smalltalk (CS 6) registration

4. APL as First Language for CS

5. SoftEng or CS Graduate Program Search

6. Test and Set (TS) vs Compare and Swap (CS)

7. Refactored Plus All Missing CS ANSI Tests In SIF

8. Camp Smalltalk (CS 6) registration

9. vwnc@cs.uiuc.edu

10. Next instr of the week - CS please

11. CS Refactoring Browser Extensions

 

 
Powered by phpBB® Forum Software