c++ - Conditional weak-linked symbol modification/redeclaration -
i have following weakly linked declaration:
extern __attribute__((visibility ("default"))) type* const symbolname __attribute__((weak_import));
the problem is, symbol may or may not defined, depending on operating system.
so, when use func(symbolname);
, signal 11 crash because attempting dereference of null. ask if(&symbolname != null) { func(symbolname); }
, require using symbol remember asking question, not optimal.
i looking wizardly magic conditionally modify or redeclare symbol, if unavailable, have default value func
work with.
i understand ugly solution , not recommended. @ point, want know if there way it, no matter how ugly or low-level.
Comments
Post a Comment