Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wanto to define a custom proxy/stub com object At VC6.0 Envirment,steps as follow:
1、Define A Simple IDL File
2、Compile it by MIDL
3、Add *_i.c、*_p.c、*.h、*.def To Empty Win32 DLL
4、Define Funtion:DllGetClassObject、DllCanUnloadNow etc.
5、Compile All Dll
Link Error Happened:
**************************************************************
Main.obj : error LNK2005: _DllGetClassObject@12 already defined in dlldata.obj
Main.obj : error LNK2005: _DllCanUnloadNow@0 already defined in dlldata.obj
Main.obj : warning LNK4006: _DllGetClassObject@12 already defined in dlldata.obj; second definition ignored
Main.obj : warning LNK4006: _DllCanUnloadNow@0 already defined in dlldata.obj; second definition ignored
Creating library Debug/HelloProxyStub.lib and object Debug/HelloProxyStub.exp
HelloProxyStub.exp : warning LNK4070: /OUT:HelloProxyStubDef.dll directive in .EXP differs from output filename "Debug/HelloProxyStub.dll"; ignoring directive
Debug/HelloProxyStub.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
**************************************************************
Posted

The macro DLLDATA_ROUTINES in your dlldata.c

has already defined DllGetClassObject and DllCanUnloadNow,
so you have not to do it twice (your fourth position) :)
 
Share this answer
 
To upstairs:Thank You And I Have Other Question
If i want to realize a custom proxy/stub structure,I Must Build More Than One Proxy/Stub For All Com Object?Such As:ClassFactory、COM Class1、COM Class2,Because The macro DLLDATA_ROUTINES in dlldata.c
has already defined DllGetClassObject(This Function Definition A Com Object)。
 
Share this answer
 
I think, the first parameter of DllGetClassObject
could be different for the different classes... :)
 
Share this answer
 
To Upstairs:
DllGetClassObject Is Defined By MIDL,How Can I Change its Definition?and How does The Com library know which class is derived from
the custom interface?
 
Share this answer
 
A Proxy DLL is a gate only :)

The creation of a class instance -
is a task of your server :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900