[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] pass by value and callbacks
From: |
pluijzer . |
Subject: |
[Chicken-users] pass by value and callbacks |
Date: |
Sat, 8 Mar 2014 23:51:41 +0100 |
Hello chickeners,
I am trying to wrap a function that accepts a function pointer with an
argument to a struct passed by value.
I don't know how to do this (and fear it is not possible) but maybe
somebody else has a solution.
A little example of what I mean:
----
#>
typedef struct { int x, y; } Point;
typedef void (*SomeCallbackFuncType)(Point point);
void someFunc(SomeCallbackFuncType callback)
{
Point p = {1, 1};
callback(p);
}
<#
(define-external (callbackFunction (??? point))
void
(print "Hello from callback!"))
((foreign-lambda void "someFunc" c-pointer) #$callbackFunction)
----
I don't actually need the the value of the object in my callback.
Maybe that helps.
Thank you in advance,
Pluijzer
- [Chicken-users] pass by value and callbacks,
pluijzer . <=