OmniObjects
OmniObjects is a lightweight replacement for DCOM, suitable
for many
uses. It's still a alpha project, but it's being actively
developed.
You can download the lastest version here.
Don't forget to check out the instructions,
the release notes and the OmniObjects
SourceForge project page.
Why replacing DCOM
DCOM is a good platform, but has some problems:
- DCOM has
complicated permission configurations;
- DCOM depends on
RPC. RPC has some ports limits and it's also hard to configure;
- It's hard (some would say impossible) to
configure DCOM to pass through firewalls.
- There's no good implementation outside Microsoft Windows.
- It's closed source, you can't debug DCOM infrastructure if
you find some cumbersome problem.
How I do expect to solve these problems with OmniObjects:
- OmniObjects is Internet ready. With extensible
communication architecture, you can configure the ports, use
TCP, UDP or HTTP and change whatever you want about communication. You
can even make a new connector and send your method calls via e-mail.
You don't need to find alternatives to COM just because DCOM is hated
by every firewall in the whole Earth. Forget porting you code to SOAP,
WCF, [insert another new
buzzword here], with OmniObjects you can keep your COM
objects working.
- If your program
needs to make some kind of TCP/IP communication, you can host the
OmniObjects within your application and make the network communication
as simple as a function call, and in a object oriented way. You can
make an Instant Messenger using COM, and the message send code
will be as simple as pImServer->SendMessage("user123",
"hi!"). Host your objects using OmniObjects
and you will never need to deal with raw sockets by yourself
again. Sounds wonderful, doesn't it? :-)
OmniObjects Overview
client → proxy
→ serialization lib → channel →
serialization lib → stub
→ object
How to make your COM object compatible with OmniObjects
All you have to do is to generated and compile a OmniObjects proxy/stub
dll. Use OmniIdl.exe to generated all the proxy/stub code from
your IDL file (more details below), build the DLL and register it. This
is it. You don't need to modify your original code, you don't even need
the sources, just the IDL file.
Project Status
What we have:
- This über ugly web page.
- The OmniIdl is generating the proxy/stub for all oleautomation types we need.
- The refcount and QueryInterface for remote objects is working great.
- The OmniObjects DLL has a kernel, a proxy manager, a stub
manager and a TCP connector.
- We have a test component and a test program. If you want to
see some action, step into OmniSimpleHost.exe (the program that wait
for remote clients) and into the OmniTestClient (the program
that instantiate a remote object and call some methods). It's a simple
and very effective way to understand
how things works.
- A good COM smart pointer, omni_ptr. Since it doesn't
overload the & operator, it can be put into STL containers. It
has some safer methods CComPtr and _com_ptr_t lacks.
Since we're just 0.40 yet, I still need to do some work to make things
better. What we don't
have:
- You need Visual C++ 8 with ATL 8 to build the proxy/stub.
The ATL dependency will be removed soon, but it's still there.
- We support the basic C++ types (char, short, int, etc) and the
main automation types (BSTR and VARIANT, no SAFEARRAY yet).
I think it's enough for most projects, but we plan to add support
for this more date types later.
- OmniIdl doesn't support structs. But you can use an object instead
- We don't have preprocessor support for OmniIdl.
The OmniIdl is adding common #defines to the know types list (LPCSTR,
ULONG, UCHAR, etc).
- We don't support custom marshaling.
- We need a descent host, OmniSimpleHost host is "test
purposes
only".
What I want to do before 1.0:
- Make the ATL dependency optional, so we can port
OmniObjects to other platforms and to Visual C++ Express + Microsoft
Platform SDK. Porting OmniObjects to Linux is a priority.
- Support hosting components we don't have the source. All we
need to do is to generate proxy/stub from a type library instead of an
IDL file. We need to support custom marshaling as well.
- Host objects within Microsoft Internet Information Server
(IIS) and Apache. It will make much easier to make components Internet
ready, in a transparent fashion.
- Support non-COM objects from another languages, like Python
and C#. We just need a translation layer for data types and a
communication between the language/framework and the OmniObjects module.
- Make the code compatible with non Microsoft C++ compilers.
Things you must
know before use the code
- I would like to make this code multi platform, but it
isn't. You need Windows
and Visual Studio 2005 to build it.
- You can't use the Express version because OmniObjects
depends on ATL 8. It's easy to back port it to Visual Studio 2003, but
you will not get it to work with ATL 3 (Visual C++ 6 and Visual C++
Express 2005 with Platform SDK).
- You need Boost
to build OmniObjects.
Hacking and understanding
OmniIdl.exe: it's the idl compiler and proxy/stub
generator. Run it against an IDL
file
and it will generate the proxy/stub source code and a Visual C++ 8
(Visual
Studio 2005) project.
There is an OmniTestComLibrary project in OmniObjects source root, you
can
use it to test how OmniIdl works. Running '..\..\bin\OmniIdl.exe
OmniTestComLibrary.idl', will yield the following files:
- OmniTestComLibrary_OmniPS.cpp: COM DLL implementation
(DllGetClassObject, etc).
- OmniTestComLibrary_OmniPS.def : functions to be exported.
- OmniTestComLibrary_OmniPS.h: Proxy/stub implementation.
You can
insert it into your VC7+ project if you want to compile the proxy/stub
within your COM DLL.
- OmniTestComLibrary_OmniPS.vcproj: Visual C++ 8 project.
Build and register and you're ready to go.
OmniObjects.dll:
it's the
OmniObjects runtime. The marshaller and the TCP/IP channel at
implemented in this DLL. A proxy/stub DLL generated by
OmniIdl.exe depends on this DLL. It has some proxy/stub
declared
for the internal
types, but they are compiled together (the
OmniObjectsInternalObject_OmniPS.h is included in this project).
OmniSimpleHost.exe:
it's just an example about using the OmniObjects hosting API.
OmniTestComLibrary.dll:
it's
a simple COM library used to show how to add OmniObjects support to an
existent COM Project and how to generate the proxy/stub. Check for the
projects build steps to see how we generated the proxy/stub code.
OmniTestClient.exe: it's a simple OmniObjects client, it
calls methods provided by
OmniTestComLibrary. Debug it to see how the whole magic works.
Release Notes
Version 0.4 release notes
- OmniIdl now supports the [size_is] attribute.
- The communication protocol was changed so arrays using [size_is] can be transmitted.
- The [string] attribute is now supported.
- OmniIdl now log the filename and line number when some error occurs during the code generations phase.
Version 0.3 release notes
Now you can pass objects (interface pointers) as parameters,
and all the proxy/stub stuff will be done automagically.
Also, several improvements was made in the code, mainly error handling
and TCP connection management.
Version 0.2 release notes
Now the refcount and the QueryInterface is working correctly for remote
objects. If you want to test OmniObjects for your remote
infrastructure, it's time.
First time you open the OmniObjects.sln, Visual Studio will
complain
that
the OmniObjectsTestComLibrary_OmniPS project doesn't exists. Build the
solution, right click over this project and choose to reload it. This
is a
proxy/stub project, and it will be generated during the
OmniObjectsTestComLibrary build. After this, build it. You can remove
this warning building the solution using the "vcbuild.exe" before
opening it with the VS IDE.
Version 0.1 release notes
First time you open the OmniObjects.sln, Visual Studio will
complain
that
the OmniObjectsTestComLibrary_OmniPS project doesn't exists. Build the
solution, right click over this project and choose to reload it. This
is a
proxy/stub project, and it will be generated during the
OmniObjectsTestComLibrary build. After this, build it.
There's a known memory leak in the marshaller.
The OmniObjects "Team"
The team (the 'we' appearing some times in the above text :-)) is
just me, Rodrigo Strauss. If you want to help or send some suggestion,
drop me a
message via the Source
Forge project page or via my personal web page
(only in portuguese yet)
Hosted by