Closed ianh closed 4 years ago
One idea is to generate unique names for all the external-linkage functions, then add static inline wrappers around each of them.
struct owl_ref owl_next_797fb01a(struct owl_ref);
static inline owl_ref owl_next(struct owl_ref r) { return owl_next_797fb01a(r); }
This way the function names are only visible within the translation unit where that header file is included.
sounds like a reasonable approach.
We also noticed for our use case that some of our parsed_XXX items shared names for common enough tokens. Perhaps an "API Prefix" (e.g. my_foo_dsl_parsed_XXX) supplied when the parser is generated?
As of e359f9c, you can now specify -p/--prefix on the command line to replace both owl_
and parsed_
with your custom prefix. Let me know if this works for you—I figured it would be better for readability to replace the prefixes rather than tacking more on.
Verified this works for us - thanks!
Owl's generated parsers declare function names with external linkage. This is a problem if you want to include two different parsers in the same program.