Solved

Linking a C program with a COM (component object model) library

Posted on 2004-03-25
2
239 Views
Last Modified: 2008-02-01
Hi,
I am writing a program in C (can not use anything else due to limitations of the application) and I have to make calls to a COM library, but I can't a find a way to link these programs or to make a call from the C program to the COM library.

Does anyone know how to do it?

Thanks,

Rocky
0
Comment
Question by:rocharodo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
millsoft earned 250 total points
ID: 10683733
I strongly suggest you find the book "Inside OLE" by Kraig Brockshmidt.  It will explain it in good detail.  I think the book is out of print, so you'll probably have to get a used copy.

You don't directly link your 'C' code to COM objects.  You load COM objects at run time with the CoCreateInstance family of Windows API functions.  (I'm assuming you're working on Windows, since that is where COM usually shows up.)  If you are in a different environment, your environment will have similar functions to load the COM objects.

Basically when you call CoCreateInstance, you get a pointer to an structure of function pointers that you use to call functions on the COM objects.  

The main chapters in Kraig's book you will need are Chapters 1 & 2 -- it's about 140 pages of highly technical stuff, so I really, REALLY suggest you get a copy.

Hope this helps.

Brad

P.S. can you explain the limits of your app that require 'C'?

0
 

Author Comment

by:rocharodo
ID: 10858207
Brad,
thanks for the info, I finally got the book that you suggested and looks very interesting.

I have also found the following website http://www.cascadia.ctc.edu/facultyweb/instructors/mpanitz/COM_Tutorial/COMClientInC.html

it explains in very details what I am trying to do.

thanks

Rodolfo
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question