Hello. I have a few questions: 1) Why do the docs say that racket_eval and racket_apply eval and apply in the “initial” or “original” racket thread? I have verified that the thread id returned from pthread_self when using racket_apply in c code called from a racket place is different from the thread id of the thread i called racket_boot on.
2) I noticed that if i racket_eval in c code called by a racket place, i can’t evaluate things that would otherwise (in racket code) be available in the place’s namespace. What is the correct way to get at things in the place’s racket namespace from c code? Is my problem unique to using a place, or would i have this problem in a non-place scenario as well? 3) (related to 2) I want to be able to put and get from a place channel from a long-running c function. If i just pass a place channel to the function, that is wrong because if i am correct in my thinking (and in what i have witnessed) there is a chance that when i go to use that channel in the future, it will have been moved by the garbage collector. Is there any way to prevent a specific value from being garbage collected, at least for the lifetime of my place? This is related to (2) because i actually don’t need this functionality if i can just racket_eval to get at the place channel from the namespace of the place’s module in the middle of a Sactivate_thread / Sdeactivate_thread session. 3) Is there any way to pass a c callback function into racket so that racket can call that function? I defined a ctype for the function, but i couldn’t think of a way to cast a pointer value passed into racket from c to an instance of my ctype (the `cast` function takes existing ctypes and not numeric values). Is there any way to manually make a value for my function ctype using an existing pointer value? Regarding 2 and 3, i was able to solve the underlying problem behind those questions by creating a module to stash the channel in and passing its module path into c code, then importing it. I wonder if anyone has a better solution? Previously, i was using the `place` function for brevity. Here is what i did: (module myplace racket/base (provide place-main) (require syntax/location) (module stash racket/base (provide client-channel) (define client-channel (make-parameter #f))) (require 'stash) (define (place-main ch) (client-channel ch) (red_client_run_from_racket ch (quote-module-path stash)) (error "Should not get here"))) (define p (dynamic-place (quote-module-path myplace) 'place-main)) and in c code: int red_client_run_from_racket(ptr ch, ptr path) { ... racket_namespace_require(path); ... } Thank you Nate -- 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/CAM-xLPpU7sQ7PoArCf27W4BVZzM-%2BUu2v4Abp2%3DubuPiFi%3D%2Bvg%40mail.gmail.com.