Am Sonntag, 12. Juli 2020, 03:58:27 CEST schrieb Serge Balakshiy via Gforth discussion and announcements: > Dear > Anton Ertl > > I have myprog program. This program is written in C. The program has a > global pointer to all * mypoint. I want to embed gforth in my program. I > need to write a function in this program > void p_setpoint( int x, int y, int mode ){ > mypoint->setpoint(x, y, mode); > push(1); > } > static struct primfcn funcs [] = { > {"0SETPOINT", p_setpoint}, > {NULL, (codeptr) 0} > }; > void run_gforth_script(){ > … > // I want to write something like this here > gforth_primdef(funcs);?????
Use the libcc.fs C bindings to call your C program. You don't need actual primitives for that. Gerald Wodni's fork of SWIG can parse your .h file, and generate those bindings for you. You need to link your program with a switch that it exports dynamic functions (like a shared library), to make this work. -- Bernd Paysan "If you want it done right, you have to do it yourself" net2o id: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ* https://net2o.de/
signature.asc
Description: This is a digitally signed message part.