Consider the following interface:
struct funky; // forward decl
struct funky * funky_alloc (void);
void funky_dealloc (struct funky *);
int funky_dowhatever (struct funky *);
No magic, just C. The structure is private. All the user sees is pointers but the pointers are typed so the compiler can do the "magic" checking. Keep it simple.
Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds