Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How to callback C functions in the binary main program from a Ch script?

0
Posted

How to callback C functions in the binary main program from a Ch script?

0

Please read chapter 5 section “Calling Back C Functions in the Main Program from Ch Space” in Embedded Ch User’s Guide located at CHHOME/docs/embedch.pdf. We provide many examples for different situations for handling callback C functions in the main program from Ch scripts. It includes an example to pass a function from C to Ch, and then pass it back from Ch to C, and callback in C. Below is a sample C code embedch3.c with a C function func() called from a Ch script embedch3.ch. The API Ch_DelcareFunc() makes the function func() available in the script space. The aruments from the script space are passed to the interface function func_chdl() first in the binary space, which in turn calls the binary function func(). The interface function func_chdl() can be automatically generated using the utilities provided in the Embedded Ch SDK.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123