4 ms·
Such binaries will not be able to use anything but the special C-compatible types and calls, which is quite the limitation. Image if C++ static libraries could
by lerno 3y ago
Such binaries will not be able to use anything but the special C-compatible types and calls, which is quite the limitation. Image if C++ static libraries could only use C compatible POD structs and none of the C++ parameter types for example.
- flohofwoe 3y ago> Image if C++ static libraries could only use C compatible POD structs and none of the C++ parameter types for example. That's the only way to expose a C++ library to other languages though, or even make a DLL written for one C++ compiler consumable by a program written with another C++ compiler. It's a limitation for sure, but definitely not a show stopper.
- pjmlp 3y agoIt isn't the only way, COM based APIs and similar approaches in Apple and Google platforms, allow for a more rich ABI without being constrained to C.
- flohofwoe 3y agoAs far as I'm aware, COM based APIs *are* C-APIs, just with a couple of additional conventions for lifetime management via refcounting, versioning interfaces and wrapping C++ classes into structs with function pointer jump tables ;)
- pjmlp 3y agoFrom that point of view they are Assembly APIs as well, after all C API is just a convention of registers being used and call frames.
- gingerBill 3y agoThey are just C-APIs which have a V-table, and Odin added a feature specifically to make dealing with them easier in the language too. e.g. https://pkg.odin-lang.org/vendor/directx/d3d12/#ICommandQueue https://pkg.odin-lang.org/vendor/directx/d3d12/#ICommandQueu... * command_queue^.id3d12commandqueue_vtable^.BeginEvent(command_queue, MetaData, pData, Size) * command_queue.id3d12commandqueue_vtable.BeginEvent(command_queue, MetaData, pData, Size) // no need for the explicit dereferencing with ^ * command_queue.BeginEvent(command_queue, MetaData, pData, Size) // the vtable has `using` on it * command_queue->BeginEvent(MetaData, pData, Size) // the -> operator will pass the value into the first argument The `->` operator was added specifically for COM API stuff, and has been useful for the Objective-C stuff too.