Libcom Documentation

From LSDevLinux
Revision as of 12:10, 21 January 2010 by Mayhewn (talk | contribs) (Categorize)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Documentation for libcom. (This documentation is a work in progress)


libcom supports any mix of C/C++ and .NET clients and servers. So, for example, a C++ COM client can use a C++ COM server, a C++ COM client can use a .NET COM server, a .NET COM client can use a C++ COM server, etc.

components map

You'll need to make a which associates GUIDs to library files. When you run your client, you will need to specify the location of the files in a COMPONENTS_MAP_PATH environment variable.

For example,

$ COMPONENTS_MAP_PATH=../dir1:../dir2 ./client

Related COM servers can be grouped together in a directory with a for all COM servers in that directory. So for example, /usr/lib/FieldWorks/Common/ and /usr/lib/FieldWorks/TE/ might each contain one and several .so shared object files.

For example, for the following tree of files


one might use a command such as

$ COMPONENTS_MAP_PATH=/usr/lib/FieldWorks/Common:/usr/lib/FieldWorks/TE mono /usr/lib/FieldWorks/TE/TE.exe


During development, some simple IDL, C/C++, and C# code was written to test needed functionality of libcom. This code is in the test directory and should serve as a rough example of how to use libcom. The example/test code isn't very polished at the moment; some of it is very old and crufty and is not an example of good COM programming in general but should demonstrate how to make a program use libcom.

Because libcom was written to be a drop-in replacement for certain functionality of Microsoft COM, it should hopefully not require a lot of changes to code that already works with Microsoft COM.

Take note of test/ for how things get built.

Here is a table showing which files use C/C++ or C# COM clients or servers.

Client Server Files
C/C++ C/C++
  •, Ball
  • Bag is a COM client to a Ball COM server (see Bag::ProvideBall, Bag::InspectBall), tho this happens when invoked by Tester.cs.
C# C/C++
  • ComClient.cs, Ball
  • Tester.cs, Bag, Ball, Wall
  • BakeryJarTestClient.cs, Bakery
C/C++ C# Bakery is a C++ COM client to a Jar C# COM server
C# C# BakeryJarTestClient.cs, Jar [Actually this might just be bypassing COM]

Note that the Wall test isn't finished and prints some garbage characters.

See also