Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many compile errors due to IMP caching on Apple #1

Open
iamleeg opened this issue Sep 6, 2020 · 0 comments
Open

Many compile errors due to IMP caching on Apple #1

iamleeg opened this issue Sep 6, 2020 · 0 comments

Comments

@iamleeg
Copy link

iamleeg commented Sep 6, 2020

Modern clang compilers targeting the Apple runtime (sorry, I don't know since which version exactly, except that Catalina 10.15 behaves like this) expect IMPs to be called in a type-safe fashion. The type is defined as void (*IMP)(void) and to use one, you have to cast it to e.g. id (*valueForKeyIMP)(id, SEL, id) or whatever type you need.

The uses of IMP caching throughout GDL2, both through static inline functions and compiler macros, thus cannot be compiled on macOS. I'd be happy to submit a PR, but having realised how big a yak to shave this is, wanted to discuss three possible implementations and see which is preferred:

  1. remove all the IMP caching. If you know that there's a current use case for GDL2 where going through the ObjC runtime is too slow then of course this is a non-starter.
  2. Use the runtime API for fast method invocation on the Apple runtime. I don't know what the performance implications of this vs. IMP caching are.
  3. insert casts in every header where GDL2 currently defines an IMP-cache-using function or macro.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant