Help me understand FFI callouts in this context?

Sage Gerard <sage-nnKKxiom5Z1/[email protected]>
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <8pQ1Vo6gPYsLf34Uy4IKRsXkFo2CtYfOHGIYT5KBhUPjVx28CCm0Sz1Jz2_S3wfd4ncrEpnKOEjtlKeLxOWCeN5toK0IRtg_Kq6rOKnz1W8=@sagegerard.com>
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/8pQ1Vo6gPYsLf34Uy4IKRsXkFo2CtYfOHGIYT5KBhUPjVx28CCm0Sz1Jz2_S3wfd4ncrEpnKOEjtlKeLxOWCeN5toK0IRtg_Kq6rOKnz1W8%3D%40sagegerard.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.