Page 1 of 1
COM Linker problem
Posted: November 14th, 2010, 7:19 pm
by Cuchulainn
I have a COM-based application. When I link I get an error stating that IID and CLSID information is not created. The problem is well known and you need uuid.lib in the MS SDK.But the advised project setting don't help on VS2008 or VS2010.Any ideas? thanks!
COM Linker problem
Posted: November 14th, 2010, 10:08 pm
by CurtHagenlocher
Can you provide a more-specific error message or information? Is this an undefined symbol from the linker? Or is it the post-build registration that's failing?
COM Linker problem
Posted: November 15th, 2010, 12:41 am
by farmer
QuoteOriginally posted by: CuchulainnWhen I link I get an error stating that IID and CLSID information is not created. The problem is well known and you need uuid.libHelp me understand your terms. I am more trying to learn than help, and it has been a while since I used com tools. I thought in static linking, you do not need class id. Can you just load or instantiate directly from the dll, and not worry about it?In the past I have had big problems with Microsoft classes that have been deprecated. There is still the interface kicking around in some dll, and still the id in the registry, but nothing works.Are you using CoCreateInstance or something similar?
COM Linker problem
Posted: November 15th, 2010, 3:08 pm
by Cuchulainn
Ok.I have reduced the scope to a COM 101 with 1 component and one interface method. Eventually got rid of the linker error. My goal is to do all steps manually (ONCE), including creating my own idl file and shoving it into the MIDL compiler to generate .c files which are input to creating a proxy/stub DLL (btw ATL does all this stuff automagically). I think this latter step does not work because I cannot see the generated dll. And I get failed CoCreateInstance (IID_IDraw and/or CLSID_CComponent).Will post the code when I have done some more tests. Including using ATL to generate the PS dll (that's cheating a bit).This process is very badly documented (the same job in C# is about 10 minutes work).
COM Linker problem
Posted: November 15th, 2010, 7:29 pm
by Cuchulainn
Here are the basic input files. The project builds and runs to a certain point.1. I ran MIDL to produce proxy stuff. But the question is to create the proxy dll and register it.2. So I have no linker errors now (discovered the correct .lib files to add dependencies).3. So, it seems I have not created a dll (==> I cannot register it).The question is; how to execute step 3 manually? edit: there seems to at least 3 ways to cast void**, kind of undocumented features. .A Class ID (CLSID) is a 128 bit (large) number that represents a unique id for a software application or application component. Typically they are displayed like this "{AE7AB96B-FF5E-4dce-801E-14DF2C4CD681}". You can think of a CLSID as a "social security number" for a piece of software, or a software component. IID == interface identifier, another 128-bit ID used to uniquely specify a interface.
COM Linker problem
Posted: November 15th, 2010, 8:52 pm
by CurtHagenlocher
This isn't the entirety of your source code, is it? I don't see where the DllGetClassObject is implemented. And what are you doing to stick this thing into the registry?Assuming you're using MSVC, it's insane not to use ATL to implement COM objects.
COM Linker problem
Posted: November 15th, 2010, 9:00 pm
by Cuchulainn
QuoteThis isn't the entirety of your source code, is it? I don't see where the DllGetClassObject is implemented. And what are you doing to stick this thing into the registry?That's all the code I have created till now. I will check the DllGetClassObject. QuoteAssuming you're using MSVC, it's insane not to use ATL to implement COM objects. I agree 200%.I usually use ATL for C++. Even easier is shared addin in C#(my preference) or C++/CLI.But the objective is to do it manually _once_ and then no more
COM Linker problem
Posted: November 18th, 2010, 2:33 pm
by CurtHagenlocher
Out of curiousity, have you made any further progress on this?
COM Linker problem
Posted: November 18th, 2010, 2:51 pm
by Cuchulainn
QuoteOriginally posted by: CurtHagenlocherOut of curiousity, have you made any further progress on this?I studied all the IClassFactory and will soon extend my code for this. It's pretty clear but all that code to write. Basically, I had only some of the soution as mentioned. I will post when I make some more progress. I have used ATL a lot but am now looking at the ATL Internals to see what the generated code means. In practice, I have only used ATL simple objects because they can be interfaced with Excel.//BTW is it possible to define more than 1 menu button (+events) in an ATL simple object? Do I need to define several dispids and callbacks?