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;
};
callback* foo(int x)
{
callback* y;
y->classHandle=(long)x+1;
y->objectHandle=(long)x+1;
return y;
}
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
mhl@cs.nott.ac.uk <mailto:mhl@cs.nott.ac.uk>
http://www.cs.nott.ac.uk/~mhl/ <http://www.cs.nott.ac.uk/%7Emhl/>
|