I am porting some C++ code to Racket that uses a function pointer.

C++ origin: See 294 through 306: 
https://github.com/Erkaman/vulkan_minimal_compute/blob/master/src/main.cpp#L294
Racket destination: 
https://github.com/zyrolasting/racket-vulkan/blob/master/examples/mandelbrot.rkt#L240

How do I use function-ptr on debug-report-callback to produce a valid function 
pointer [matching this 
signature](https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/PFN_vkDebugReportCallbackEXT.html)?

My current error comes from line 250, on the expression (function-ptr 
debug-report-callback _PFN_vkDebugReportCallbackEXT):

; function-ptr: contract violation
;   expected: (and ctype? (lambda (ct) (eq? 'fpointer (ctype->layout ct))))
;   given: #<ctype>

It seems that my error was that _PFN_vkDebugReportCallbackEXT was 
(_cpointer/null (_fun ...)), but I am not sure what should take its place.

- If I substitute _fpointer for _PFN_vkDebugReportCallbackEXT, I get the 
"application; not a procedure" error.
- If I substitute the _fun form with the signature I want, then I get 
"#<ctype>->C: argument is not `#<ctype>' pointer"

I suspect this has something to do with the callout concept from the manual, 
but I don't understand how it applies here.

~slg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/8pQ1Vo6gPYsLf34Uy4IKRsXkFo2CtYfOHGIYT5KBhUPjVx28CCm0Sz1Jz2_S3wfd4ncrEpnKOEjtlKeLxOWCeN5toK0IRtg_Kq6rOKnz1W8%3D%40sagegerard.com.

Reply via email to