Hello everyone,
I am a developer from C++ COM to C# COM. I feel confused about the entry
point function for a C# COM object.
In C++, we always initialize object through GetClassObject or
DLLGetClassObject, but it seems C# does not need these functions?
Here is a sample from MSDN. http://msdn2.microsoft.com/en-us/lib...38(VS.71).aspx
So, in C# do we need to implement the required functions like
GetClassObject? If no need, which function is the entry point for C# COM
object -- I want to find the entry point function so that I can verify that
my C# COM object can begin to talk with other COM clients.
thanks in advance,
George 3 5632
"George" <Ge****@discussions.microsoft.comwrote in message
news:03**********************************@microsof t.com...
Hello everyone,
I am a developer from C++ COM to C# COM. I feel confused about the entry
point function for a C# COM object.
In C++, we always initialize object through GetClassObject or
DLLGetClassObject, but it seems C# does not need these functions?
Here is a sample from MSDN.
http://msdn2.microsoft.com/en-us/lib...38(VS.71).aspx
So, in C# do we need to implement the required functions like
GetClassObject? If no need, which function is the entry point for C# COM
object -- I want to find the entry point function so that I can verify
that
my C# COM object can begin to talk with other COM clients.
thanks in advance,
George
You don't (can't) have to expose the COM activation/deactivation entry
points, this is taken care of by mscoree.dll, who is registered as the
"real" COM server when you register a .NET assembly as COM server (using
regasm.exe for instance). mscoree.dll takes care of loading the CLR whenever
you create an instance of a .NET class from a native COM client, the CLR
takes care of loading the .NET assembly and exposing the core COM interfaces
(IUnknow) and the interfaces you declared in your code.
Willy.
Thanks Willy,
I have made some practices using regasm and following your comments. C# COM
development is really defferent from C++ development from entry point.
I am using MSDN sample COM server, http://msdn2.microsoft.com/en-us/lib...71(VS.80).aspx
Then regasm will generate the following statements, -
-
REGEDIT4
-
-
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
-
@="CSharpServer.InterfaceImplementation"
-
-
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
-
@="{C6659361-1625-4746-931C-36014B146679}"
-
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
-
@="CSharpServer.InterfaceImplementation"
-
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
-
@="mscoree.dll"
-
"ThreadingModel"="Both"
-
"Class"="CSharpServer.InterfaceImplementation"
-
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
-
PublicKeyToken=null"
-
"RuntimeVersion"="v2.0.50727"
-
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
-
"Class"="CSharpServer.InterfaceImplementation"
-
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
-
PublicKeyToken=null"
-
"RuntimeVersion"="v2.0.50727"
-
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
-
@="CSharpServer.InterfaceImplementation"
-
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
-
Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
-
-
I find only public class InterfaceImplementation is in the reg file, but
public interface IManagedInterface is not in reg file. I do not know why
regasm only cares about public classes -- why interface is not in reg file?
(I think for client, the interface may also be used in application?)
regards,
George
"Willy Denoyette [MVP]" wrote:
"George" <Ge****@discussions.microsoft.comwrote in message
news:03**********************************@microsof t.com...
Hello everyone,
I am a developer from C++ COM to C# COM. I feel confused about the entry
point function for a C# COM object.
In C++, we always initialize object through GetClassObject or
DLLGetClassObject, but it seems C# does not need these functions?
Here is a sample from MSDN. http://msdn2.microsoft.com/en-us/lib...38(VS.71).aspx
So, in C# do we need to implement the required functions like
GetClassObject? If no need, which function is the entry point for C# COM
object -- I want to find the entry point function so that I can verify
that
my C# COM object can begin to talk with other COM clients.
thanks in advance,
George
You don't (can't) have to expose the COM activation/deactivation entry
points, this is taken care of by mscoree.dll, who is registered as the
"real" COM server when you register a .NET assembly as COM server (using
regasm.exe for instance). mscoree.dll takes care of loading the CLR whenever
you create an instance of a .NET class from a native COM client, the CLR
takes care of loading the .NET assembly and exposing the core COM interfaces
(IUnknow) and the interfaces you declared in your code.
Willy.
"George" <Ge****@discussions.microsoft.comwrote in message
news:8B**********************************@microsof t.com...
Thanks Willy,
I have made some practices using regasm and following your comments. C#
COM
development is really defferent from C++ development from entry point.
I am using MSDN sample COM server,
http://msdn2.microsoft.com/en-us/lib...71(VS.80).aspx
Then regasm will generate the following statements,
-
REGEDIT4
-
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation]
-
@="CSharpServer.InterfaceImplementation"
-
[HKEY_CLASSES_ROOT\CSharpServer.InterfaceImplementation\CLSID]
-
@="{C6659361-1625-4746-931C-36014B146679}"
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}]
-
@="CSharpServer.InterfaceImplementation"
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32]
-
@="mscoree.dll"
-
"ThreadingModel"="Both"
-
"Class"="CSharpServer.InterfaceImplementation"
-
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
-
PublicKeyToken=null"
-
"RuntimeVersion"="v2.0.50727"
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\InprocServer32\0.0.0.0]
-
"Class"="CSharpServer.InterfaceImplementation"
-
"Assembly"="CSharpServer, Version=0.0.0.0, Culture=neutral,
-
PublicKeyToken=null"
-
"RuntimeVersion"="v2.0.50727"
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\ProgId]
-
@="CSharpServer.InterfaceImplementation"
-
[HKEY_CLASSES_ROOT\CLSID\{C6659361-1625-4746-931C-36014B146679}\Implemented
-
Categories\{62C8FE65-4EBB-45E7-B440-6E39B2CDBF29}]
-
I find only public class InterfaceImplementation is in the reg file, but
public interface IManagedInterface is not in reg file. I do not know why
regasm only cares about public classes -- why interface is not in reg
file?
(I think for client, the interface may also be used in application?)
regards,
George
The /reg option is meant for informational purposes only, you should
register your classes with the /tlb option. Classes that are registered
using the reg file won't be able to be created using CoCreateInstance, nor
will it include the (optional) registration done by the custom registration
functions (see ComRegisterFunctionAttribute).
Willy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Laurent Schall |
last post by:
I experience a problem where starting an application compiled with
visual C++ 6 SP5 does not execute the function main(int argc, char
**argv) and exit immediately with code 1 (0x1).
Putting main...
|
by: aneesh |
last post by:
Hi all,
I would like to know whether we can specify another function instead
of main as entry point.
Thanks
Aneesh
|
by: Vijay Kumar R Zanvar |
last post by:
I have following questions:
1. Appendix C of K&R says:
Trigraph sequences introduced by ?? allow
representation of characters lacking in some
character sets. ...
Can somebody explain how...
|
by: TRI_CODER |
last post by:
I am trying to solve the following exception. The exception occurs when my
ASP.NET code behind code attemtps to access a remore site using SSL. Please
note that all certificates are valid and the...
|
by: Mike in Santa Rosa |
last post by:
I'm trying to get a simple c# app built that can launch/manipulate an excel
workbook, sheet. I've chased down several examples and can't any of them to
work. So I must be doing somethnig obviouslt...
|
by: Johnny |
last post by:
Hi,
Is there a way to detect the entry point of all the functions in a
project? If so, can I make a function that will be called at the every
entry point? Thanks for your consideration.
...
|
by: bboule |
last post by:
Hi
I have developped a dll that I want to use in another program !
here is my code :
using System;
using System.Collections.Generic;
using System.Text;
namespace NameSpace
|
by: Lung.S.wu |
last post by:
Hi all,
It is a history question.
Recently, I read the book "C A reference manual, third edition".
In this book, it list all C language keyword, and one is "entry".
I know it is omitted from...
|
by: Premkumar |
last post by:
a.cpp
----------------------------------
#include <iostream>
using namespace std;
void mymain() {
cout<<"my-main"<<endl;
}
----------------------------------
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |