|
|
|
date: Thu, 3 Jul 2008 14:06:01 -0700,
group: microsoft.public.win32.programmer.ole
back
Re: Few small questions about COM
Jeff Autery wrote:
> Firstly, I am wondering why do we need to create .DEF file? Is it
> required only for Dynamic Load libraries?
This has little to do with COM. You need DEF file to list functions you
want exported from your DLL. It so happens that a COM server packaged in
a DLL has to export a few functions under predefined names.
> Secondly, when using local servers (exe), is it really required to
> register the exe and the proxy DLL even when nothing has been changed
> at the COM front. Registering it is no harm, but is it really
> required?
I'm not familiar with the term "COM front". What exactly has and has not
changed?
If you have already registered your server before, and only changed some
implementation details but not the interface, you don't need to register
it again, if that's what you are asking.
> Thirdly, on the system on which COM server (exe) is running do we
> need to register the proxy DLL?
Yes.
> If yes what entries in the registry
> are created?
HKCR\Interface\{Interface IID}\ProxyStubClsid32
and a few other subkeys under {IID} key.
> On the COM client system which will consume this COM
> component, is registering only with the proxy sufficient?
Yes, if the client is willing to use CoCreateInstanceEx and specify
certain information in COSERVERINFO structure that would otherwise be
looked up in the registry.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
date: Thu, 3 Jul 2008 17:26:02 -0400
author: Igor Tandetnik
Re: Few small questions about COM
"Sam Hobbs" <samuel@social.rr.com_change_social_to_socal> wrote in
message news:O1J5FSm3IHA.3500@TK2MSFTNGP05.phx.gbl
> "Igor Tandetnik" wrote in message
> news:OvJDeOi3IHA.2348@TK2MSFTNGP06.phx.gbl...
>> "Sam Hobbs" <samuel@social.rr.com_change_social_to_socal> wrote in
>> message news:O8R%23%239h3IHA.4272@TK2MSFTNGP03.phx.gbl
>>> You don't need a def file and Microsoft recomends not using one. You
>>> do have to export symbols as Igor says. You should use
>>> __declspec(dllexport) to export symbols.
>>
>> It's impossible with __declspec(dllexport) to export undecorated
>> symbols, as far as I know. That's why you need a DEF file.
>
>
> Perhaps I misunderstand the question and your answers; I know that
> there are some circumsances where a def file is needed, but I forget
> what they are.
> If "undecorated symbols" means C-style symbols (as in extern "C"),
> then __declspec(dllexport) works.
Try it.
__declspec(dllexport) STDAPI DllGetClassObject(
REFCLSID rclsid, REFIID riid, LPVOID * ppv)
{}
Build a DLL with just this declaration, then check with Dependency
Walker what name it exports. You'll find it to be something like
"DllGetClassObject@12". COM requires that the exported funciton be named
precisely DllGetClassObject.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
date: Sat, 5 Jul 2008 11:55:27 -0400
author: Igor Tandetnik
|
|