Click here to Skip to main content
15,888,270 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have followed this tutorial COM in plain C[^]
and created and registered a com object and now i need to use this com object in c#. i have tried TLBImp to generate a interop lib but getting error 'not a valid lib', i tried to register the .dll (Iexample.dll) using regsvr32 but then error came ' the DLLRegistryServer entry point is not found'.

now what should i do to be able to use it in my c# project.
i do not want to use P/Invoke and C++/CLI for this case.
Posted
Comments
CPallini 20-Aug-15 3:31am    
If you cannot register your COM component, then it is broken. You have to fix it.
barneyman 20-Aug-15 4:42am    
for the love of cheese, use ATL to create a COM object - trying to use flat C to provide an OOP solution is an exercise in frustration
F-ES Sitecore 20-Aug-15 5:41am    
Having a scan of the article, the fact that it talks about manual registration makes me think the article doesn't explain how to make a "proper" COM DLL that is recognised as such. If you follow the article you shouldn't need to use regsvr32, the object should already be creatable. As long as the object is configured and works, all you have to do is reference it from Visual Studio (it will be listed in the COM objects list) and VS will create a .net interop dll.
Philippe Mori 20-Aug-15 8:41am    
Why are you doing COM in plain C if you want to use those DLL from C#? It would be much simpler to write an assembly directly in C# or maybe in C++/CLI if you want to use some (existing) C/C++ code.
RajneeshSaysHello 21-Aug-15 7:30am    
because i think com is faster than p/invoke and c++/cli

As CPallini[^] mentioned in the comment to the question, you have to fix it. Try this: How to use the Regsvr32 tool and troubleshoot Regsvr32 error messages - Common solutions for Regsvr32 errors[^].

This might be helpful in case of necessity of changes in COM component: Exposing native to managed - C++/CLI vs. P/Invoke[^]
 
Share this answer
 
Comments
CPallini 20-Aug-15 3:56am    
5.
Maciej Los 20-Aug-15 4:35am    
Thank you, Carlo.
See Introduction to COM - What It Is and How to Use It.[^] and its follow on article.
 
Share this answer
 
Comments
Maciej Los 20-Aug-15 5:47am    
Good idea!
RajneeshSaysHello 21-Aug-15 7:29am    
thanks for the link

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