Re: C function taking two function pointers that share calculation

2022-09-14 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 14 September 2022 at 18:02:07 UTC, JG wrote: [snip] Maybe others know better but I would have thought the only way is to use globals to do this. Often c libraries that I have used get round this by taking a function and a pointer and then the library calls your function on the p

Re: C function taking two function pointers that share calculation

2022-09-14 Thread JG via Digitalmars-d-learn
On Wednesday, 14 September 2022 at 17:23:47 UTC, jmh530 wrote: There is a C library I sometimes use that has a function that takes two function pointers. However, there are some calculations that are shared between the two functions that would get pointed to. I am hoping to only need to do thes

C function taking two function pointers that share calculation

2022-09-14 Thread jmh530 via Digitalmars-d-learn
There is a C library I sometimes use that has a function that takes two function pointers. However, there are some calculations that are shared between the two functions that would get pointed to. I am hoping to only need to do these calculations once. The code below sketches out the general i