I like to write text parsers using a parser generator tool which makes it very easy to create reliable solid parsers. It produces its output as a C source file, which I compile into a DLL. I then call that DLL from PB, all easy stuff.
The fun comes when the parser wants to call back to PB to pass it some data or invoke some function. What I have been doing to date is to create a UDT in PB with a long for the address of each function. I then create a global instance of the UDT and in PBmain do a series of assignment to put the address of each function into the UDT variable.
In the C side I have an identical structure.
When I call the parser I pass the address of the UDT instance, and then in C do something like (*x.FunctionName)(parm1, parm2); It all works but its ugly.
The question is, can I misuse the PB9 interface / end interface to replace the UDT? I've had a play, and cant get further than exceptions. I dont want to go as far as "proper" COM.
The fun comes when the parser wants to call back to PB to pass it some data or invoke some function. What I have been doing to date is to create a UDT in PB with a long for the address of each function. I then create a global instance of the UDT and in PBmain do a series of assignment to put the address of each function into the UDT variable.
In the C side I have an identical structure.
When I call the parser I pass the address of the UDT instance, and then in C do something like (*x.FunctionName)(parm1, parm2); It all works but its ugly.
The question is, can I misuse the PB9 interface / end interface to replace the UDT? I've had a play, and cant get further than exceptions. I dont want to go as far as "proper" COM.
Comment