digitalmars.D.learn - dispatcher
- Psychological Cleanup (7/7) Sep 05 2017 I have a C callback that must call some functions declared in D.
- Kagamin (5/7) Sep 06 2017 Would work.
- user1234 (7/14) Sep 06 2017 1/ mark the D function as "extern(C)".
- Psychological Cleanup (3/18) Sep 06 2017 This wont work. The callback must be relatively performant and
I have a C callback that must call some functions declared in D. I can't call them off the C thread because it will result in a violation. What is a good way to dispatch the call to the main D program? I'm thinking that I might have to create an extra thread that monitors for when a call needs to occur and does so. Doesn't seem
Sep 05 2017
On Wednesday, 6 September 2017 at 05:57:18 UTC, Psychological Cleanup wrote:I'm thinking that I might have to create an extra thread that monitors for when a call needs to occur and does so.Would work. If your code doesn't conflict with GC, it's fine to work in an unregistered thread.
Sep 06 2017
On Wednesday, 6 September 2017 at 05:57:18 UTC, Psychological Cleanup wrote:I have a C callback that must call some functions declared in D. I can't call them off the C thread because it will result in a violation. What is a good way to dispatch the call to the main D program? I'm thinking that I might have to create an extra thread that monitors for when a call needs to occur and does so. Doesn't1/ mark the D function as "extern(C)". 2/ take care to how things are passed to the D functions, especially arrays. 3/ take care not to mutate memory created from the D side...i.e copy after the call.
Sep 06 2017
On Wednesday, 6 September 2017 at 09:47:34 UTC, user1234 wrote:On Wednesday, 6 September 2017 at 05:57:18 UTC, Psychological Cleanup wrote:This wont work. The callback must be relatively performant and must access the D code on the D side normally.I have a C callback that must call some functions declared in D. I can't call them off the C thread because it will result in a violation. What is a good way to dispatch the call to the main D program? I'm thinking that I might have to create an extra thread that monitors for when a call needs to occur and does so. Doesn't1/ mark the D function as "extern(C)". 2/ take care to how things are passed to the D functions, especially arrays. 3/ take care not to mutate memory created from the D side...i.e copy after the call.
Sep 06 2017