which files to include/link for a COM EXE server 
Author Message
 which files to include/link for a COM EXE server

Hi all!

Just a simple question: I have a COM component (EXE server) and Id like to
write a client for this component in C++. Which files do I have to
include/link?  I know what to do for a COM dll: I just include the
component's header file and link the additional library. But as my component
is an EXE there is no lib - so whats the required file? Only including the
header file leads to linker errors "unresolved external symbol ...".

Thanks

Markus



Sat, 21 Feb 2004 05:24:26 GMT  
 which files to include/link for a COM EXE server
Hi,

After you have included the component's header file, you should also copy
the CLSID and Interface IID into your code to make the client code compile.
Otherwise, the UUID for your class object and interface is not recognized.

There are 2 ways that one can register the DCOM objects to be activated by
clients on a remote machine:
1) Use Proxy/Stub and register Proxy/Stub Dll in both client and server
machines.
2) Use Typelibrary. Register Server in the server machine, register
typelibrary in client and use CoCreateInstanceEx and specify the remote
machine name, or
add RemoteServerName in the registry to point to the remote machine.

Hope this helps.
Regards,
Johnson.



Sat, 21 Feb 2004 11:46:13 GMT  
 which files to include/link for a COM EXE server
Also add the generated _i.c file to the client project. It contains the
definitions (as opposed to the declarations in the header) of all GUIDs.
Specify that it doesn't use precompiled headers.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> Hi all!

> Just a simple question: I have a COM component (EXE server) and Id like
to
> write a client for this component in C++. Which files do I have to
> include/link?  I know what to do for a COM dll: I just include the
> component's header file and link the additional library. But as my
component
> is an EXE there is no lib - so whats the required file? Only including
the
> header file leads to linker errors "unresolved external symbol ...".

> Thanks

> Markus



Sun, 22 Feb 2004 02:25:38 GMT  
 which files to include/link for a COM EXE server
Hi!

Thanks for your reply. Well, sorry if I'm asking again but from where should
I copy the CLSID & IID? Whats the difference between copying them into my
code and including the header file? If you are talking about 'copy', do yo
mean copy & paste or am I on the wrong way? How can I register the typelib?
Using regtlb?

Thanks again

Markus



Quote:
> Hi,

> After you have included the component's header file, you should also copy
> the CLSID and Interface IID into your code to make the client code
compile.
> Otherwise, the UUID for your class object and interface is not recognized.

> There are 2 ways that one can register the DCOM objects to be activated by
> clients on a remote machine:
> 1) Use Proxy/Stub and register Proxy/Stub Dll in both client and server
> machines.
> 2) Use Typelibrary. Register Server in the server machine, register
> typelibrary in client and use CoCreateInstanceEx and specify the remote
> machine name, or
> add RemoteServerName in the registry to point to the remote machine.

> Hope this helps.
> Regards,
> Johnson.



Sun, 22 Feb 2004 02:19:34 GMT  
 which files to include/link for a COM EXE server
Hi Alexander!

Thanks for your answer - I think I just forgot including the _i.c file :-)
Thanks for reminding ... how can I specify not to use precompiled headers or
why is it necessary?

Regards

Markus



Quote:
> Also add the generated _i.c file to the client project. It contains the
> definitions (as opposed to the declarations in the header) of all GUIDs.
> Specify that it doesn't use precompiled headers.

> --
> =====================================
> Alexander Nickolov
> Microsoft MVP [VC], MCSD

> MVP VC FAQ: http://www.mvps.org/vcfaq
> =====================================



> > Hi all!

> > Just a simple question: I have a COM component (EXE server) and Id like
> to
> > write a client for this component in C++. Which files do I have to
> > include/link?  I know what to do for a COM dll: I just include the
> > component's header file and link the additional library. But as my
> component
> > is an EXE there is no lib - so whats the required file? Only including
> the
> > header file leads to linker errors "unresolved external symbol ...".

> > Thanks

> > Markus



Sun, 22 Feb 2004 02:26:09 GMT  
 which files to include/link for a COM EXE server
Right-click on the file/Settings/Compiler/select precompiled headers
from the combo box. This is necessary because many wizard-generated
projects have StdAfx.h set up as the default precompiled header. Your
file won't compile with this setting (StdAfx.h is precompiled by the C++
compiler _and_ it is not included in the _i.c file).

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> Hi Alexander!

> Thanks for your answer - I think I just forgot including the _i.c file :-)
> Thanks for reminding ... how can I specify not to use precompiled headers
or
> why is it necessary?

> Regards

> Markus



> > Also add the generated _i.c file to the client project. It contains the
> > definitions (as opposed to the declarations in the header) of all GUIDs.
> > Specify that it doesn't use precompiled headers.

> > --
> > =====================================
> > Alexander Nickolov
> > Microsoft MVP [VC], MCSD

> > MVP VC FAQ: http://www.mvps.org/vcfaq
> > =====================================



> > > Hi all!

> > > Just a simple question: I have a COM component (EXE server) and Id
like
> > to
> > > write a client for this component in C++. Which files do I have to
> > > include/link?  I know what to do for a COM dll: I just include the
> > > component's header file and link the additional library. But as my
> > component
> > > is an EXE there is no lib - so whats the required file? Only
including
> > the
> > > header file leads to linker errors "unresolved external symbol ...".

> > > Thanks

> > > Markus



Mon, 23 Feb 2004 01:39:59 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Lifetime of EXE COM server that uses DLL COM server

2. error LNK2005 when I include COM Server files

3. howto: include AVI file into *.exe file

4. howto: include AVI file into *.exe file

5. linking error when including COM object

6. EXE COM Server Possible in C#?

7. Serialize access to COM exe Server (long)

8. Using one COM exe server within another

9. COM servers in EXE

10. COM EXE Server - please make me sane

11. COM EXE Server Registration?

12. COM exe server

 

 
Powered by phpBB® Forum Software