Hi Suresh, 1. COM client - this is quite simple, the only you need is to call CoInitialize or CoInitializeEx at the beginning of your program, and then call CoUninitialize at the end. The most important thing you need is a C(++) interface definition of the COM objects you want to use. Many of them are already in the MinGW header files, such as IMalloc or ADO objects (adoint.h). In this case, you only need to include the appropriate header file and call CoCreateInstance to create the object you want and finally cast it to the appropriate type.
Bigger problem appears if you want to use objects which are not considered to be part of the OS, such as Adobe Acrobat Reader control. In this case you need to get the interface definition out of the Type Library. I am not aware of any OSS tool which could read type libraries and create C++ wrappers for the objects described there. Perhaps the easiest solution is to create new C++ project in Visual Studio, does not need to be ATL enabled, reference the TLB you want in the project. VS will generate two files with extensions .tli and .tlh. You can use the tlh file to create header file with the type definitions you want to use. 2. COM server - this is a bit more complicated, since you must implement several interfaces such as IClassFactory and also interfaces of your objects. If you only implement some existing interface with existing type library, you can directly link this TLB file into resource of your project. You will need the types described in TLB to implement IDispatch interface for your objects. You will do this through CreateStdDispatch API. You could avoid this by implementing of all the IDispatch methods yourself, but this is not recommended and will require lots of work. If you want to design your own interface, you will also face the problem of generating type library for your interfaces. I could not find anything else than using MIDL compiler delivered with Visual Studio for this task. ----- I don't have any COM client example at the moment I could share, although I wrote many in my life. But I can share COM server - it is an implementation of OLE DB provider for PostgreSQL database. You can compile the project both as 32 and 64 bit version. The source code is available here: http://sourceforge.net/projects/pmpostgresqlole/ (zipped in the Files section). Pavel On Sat, 2014-11-22 at 19:20 -0800, Suresh Govindachar wrote: > Hello, > > Please point me to a simple but complete, 64 bit, C++, non-gui example > of a COM server and client. I know nothing about COM but hope to have > access to the book "Essential COM" by Don Box within a week or so. Via > google, I found this thread from six years ago (Sep 2008) "COM and ATL > supporT in minGW" > http://mingw.5.n7.nabble.com/COM-and-ATL-supporT-in-minGW-td15733.html . > > Thanks, > > --Suresh > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk > _______________________________________________ > Mingw-w64-public mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
