Since C++ doesn't define an ABI, any code that relied on such a feature would end up unportable to other compilers/linkers. If there was one thing C++0x (oops, C++1x now) ought to have fixed it was this - but I guess the commitee wanted to maintain backwards compatibility at all costs, so...
As things stand, C++ will never gain support for real modules, which means we'll always need to rely on ugly hacks or fall back to extern "C" and hope the universe doesn't implode (because the C++ implementation threw an exception, for example).
[/offtopic]
Announcement
Collapse
No announcement yet.
There's A Direct3D 9.0 Gallium3D State Tracker
Collapse
X
-
The issue is that "source compatibility" requires an implementation of COM. Judging from the COM documentation, I can't imagine this task being all that simple.
Leave a comment:
-
Originally posted by BlackStar View PostSo, how do you export d3d9->CreateDevice() from a .so on Linux?
Or are you seriously suggesting that every game should include a private copy of the source code of the D3D tracker? The latter is not only insane but is also disallowed by most distros. For good reasons, too: imagine if every program required a private copy of gstreamer or mesa or whatever library.
C++ exports functions by mangling their names. The vtable is then looked up by ld.so at runtime, meaning I can insert functions, remove them, or basically completely change the entire libray, so long as I keep the function definitions for the already declared functions intact.
Now please stop posting misleading information. Exporting classes from a C++ library is inherently easy, simple and reliable.
Leave a comment:
-
Originally posted by BlackStar View PostThat's what COM does on Windows, it allows you to export C++ objects from a dll (interfaces, to be exact). It *is* possible to achieve something similar on Linux (more info) and I guess Qt is using a similar approach.
The issue is that "source compatibility" requires an implementation of COM. Judging from the COM documentation, I can't imagine this task being all that simple.
What's so difficult about exporting interfaces from a library? You only need an exported c-style function that returns a pointer to a new instance of the class in question. That's how D3D works and I don't see why it's impossible on linux...
Leave a comment:
-
That's what COM does on Windows, it allows you to export C++ objects from a dll (interfaces, to be exact). It *is* possible to achieve something similar on Linux (more info) and I guess Qt is using a similar approach.
The issue is that "source compatibility" requires an implementation of COM. Judging from the COM documentation, I can't imagine this task being all that simple.
Leave a comment:
-
Originally posted by zhasha View PostCalling a function on a COM object: (Windows)
Code:d3d9->CreateDevice(...)
Code:d3d9->CreateDevice(...)
Or are you seriously suggesting that every game should include a private copy of the source code of the D3D tracker? The latter is not only insane but is also disallowed by most distros. For good reasons, too: imagine if every program required a private copy of gstreamer or mesa or whatever library.
Leave a comment:
-
Originally posted by zhasha View Postsource compatibility
I wonder, would it be possible to grab translation code from wine to translate DX code into OpenGL code. Then either use code from an OpenGL state tracker to translate the OpenGL code to state tracker code or maybe use an OpenGL state tracker directly.
Leave a comment:
-
Originally posted by BlackStar View PostThe main issue is that DirectX is built on C++ and uses COM to export its API. Without COM, the D3D tracker is not very useful to application developers (I don't mean this in a disparaging way, just stating the facts).
Code:d3d9->CreateDevice(...)
Code:d3d9->CreateDevice(...)
Leave a comment:
-
That's what we are doing in Wine. All our code including our DirectX code is pure C. The DirectX headers contain a lot of macros for C compatibility to access methods in the right vtable. So someobject->foo(bar) is a macro like ISomeInterface_Foobar(someobject, bar) someobject->vtable->foo(bar).
Leave a comment:
Leave a comment: