2 ms·
It's possible in some languages, but it often involves serious messing around. For example, in C, this would involve function name aliasing which is usually a
by DannyBee 13y ago
It's possible in some languages, but it often involves serious messing around.
For example, in C, this would involve function name aliasing which is usually a compiler specific extension.
This might give you name compatibility, but to get struct-level compatibility, you'd have to copy the exact layouts due to padding issues.
In C++ it's even harder, due to when vtables are emitted, etc.
My java knowledge is old (java 5), so i don't know if they made it possible.
Objective-C, I believe it would only be possible if you used the runtime reflection methods directly. I don't think you can easily do it with just headers (corrections welcome!)
etc
- Nullabillity 13y agoI believe Java will look up methods etc by name (and signature) at runtime, so anything missing will just produce an exception when you try to use it.