Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

C++ doesn't define any object format, period.

A C++ implementation could provide translated units which encapsulate not only compiled code, but also contain compiled class declarations, such that these units can just be used without any preprocessing, tokenizing or parsing. That would be outside the language.

The C++ language as it stands is defined in terms of a textual representation: everything proceeds from translation units being scanned into preprocessing tokens and so forth.

To use a compiled class declaration, you would still need to see the source code somewhere, in some form, in some documentation. Otherwise, how would you know that the frobozz class has a freakout method which accepts two int parameters.



About the last bit, a long time ago I would use the ctypes library in Python to inspect, list, and call functions defined in .DLLs. All the symbol exports are right there in the object file, so for non-C++ callers you don't exactly need the source code to call functions. It doesn't seem like a large stretch to ask whether the same thing can be done with classes, or to expect that this particular aspect would have changed sometime in three iterations of the standard.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: