I am trying to refer to object files generated by clang from ObjC sources from C code, however the compiler is generating symbols not prepended by underscore so extern specification does not work. I'm using the latest Apple clang. I am guessing this must be possible, since kernels would need to do this. Anyone confirm it is possible or not, if so how to do it, if not, a workaround if known please. Thanks!
Asked
Active
Viewed 241 times
2
-
I seem to recall there is a function `__attribute__` to do this, but I can't find it now. – Nate Eldredge Aug 13 '20 at 07:35
-
Did you look up the compiler's option to not prepend the underscore? – the busybee Aug 13 '20 at 10:44
-
Near duplicate of [Adding leading underscores to assembly symbols with GCC on Win32?](https://stackoverflow.com/q/1034852) – Peter Cordes Aug 05 '23 at 08:35
1 Answers
2
Sorry I found the answer immediately after posting the question:
extern void *name asm("name");
appears to work with both clang and gcc. Not sure about Windows.

Yttrill
- 4,725
- 1
- 20
- 29