-
Notifications
You must be signed in to change notification settings - Fork 7
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
GCC/LLVM support #4
Comments
The only real Windows dependency is SysAllocString call in |
I will start working on the CoCreateInstancee implementation. Whatever that will eventually mean:) Somehow we need to ensure that the same C++ code base can be compiled on different platforms. A minor subset of the tests now compile on gcc: https://github.com/Fluxie/intercom/tree/gcc-proto. |
"Whatever that will eventually mean" is probably going to be...
After this everything is "COM": The provided pointer should implement The big question is how should we get the shared library in the first place. I see three options:
|
I started playing around with dlopen yesterday. Didn't get too far though as I had to do some shopping.
I would like to avoid any approach that requires registration, at least initially. I'm currently thinking that the wrapper C++ classes that I will eventually implement would just know which library to use when constructing the Rust object and create an instance of the object when the C++ wrapper is constructed. On Windows the constructor could just call CoCreateInstance. Side-note: We should probably generate a manifest for the Rust libraries automatically to help with the context-free activation. Registration even on Windows can be annoying when you deploy the application. |
I agree. Personally I'm not a fan of the global registration mechanism on Windows. I guess it makes sense for APIs that are meant to update with other products, such as the Office API, but for basic library usage it's just painful.
I completely forgot the wrapper classes know the library they are used with. This sounds like the perfect option.
Already part of #26. Just took a small detour of it to possibly enable the |
The branch https://github.com/Fluxie/intercom/tree/gcc-proto now has a working CMake configuration and the C++ test cases succeed. It is not fit for merge as-is, however. I will implement basic support for generating the basic C++ header files for the first pull request. |
Basic support generating the C++ headers from Rust code is now implemented in https://github.com/Fluxie/intercom/tree/gcc-proto. I no longer need the headers generated with the MIDL compiler to run the tests. |
@Fluxie Is this still pending something? I've been under the impression that GCC/LLVM support is done - the big things missing are mainly nicer interface for the C++ wrappers, but that's not really a GCC/LLVM issue as such but a general "Make C++ better" issue. |
In theory the COM libraries created using
intercom
should be cross-platform compatible. There's no major Windows dependencies involved here.The big issue is the lack of
midl
for GCC/LLVM. As such theintercom-utils
would need a newcpp-classes
or similar command that processes the Rust sources similar to whatidl
does, but instead of producing an idl file, the command produces C++ sources similar to the various_i.c
and_i.h
sources thatmidl
produces.These sources need to implement C++ classes that result in compatible vtable definitions with the COM vtables. Ideally they should use the same "stdcall" calling convention that we already use in the intercom functions for Windows COM. However we do have the option of using "stdcall" on Windows and something else that behaves better on Linux as long as that "something else" is binary compatible between GCC/LLVM/Rustc.
Tasks:
intercom-utils
.cpp
unit tests for Linux builds on Travis. This involves wrapping theCoInitialize
/CoUninitialize
in some sort ofIntercomInit
/Uninit
method that is able to call theCoInitialize
/etc. on Windows and loads the type library usingdlopen
or similar on Linux. TheCoCreateInstance
needs to be abstracted so that on Linux we acquire theClassFactory
and construct the instance manually.The text was updated successfully, but these errors were encountered: