4 ms·
Object Oriented C: Interfaces
- thechao 8y agoThis is handle-pass style, and is the most straightforward way to add objects to existing C code (it’s “backwards compatible”). However, it makes shimming and partial derivation nearly impossible. Instead, the entire table should be passed back: typedef struct intf intf; int (*newIntfCB)(intf*, ...) typedef stuct intf { void *handle; newIntfCB newIntf; } intf; (Here’s hoping beachside phone programming has resulted in valid C code.)