Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

If I register an object to the ROT (Running Object Table) that was written in C#, can a C# client get access to that object?

74 views
Skip to first unread message

Jozsef Bekes

unread,
May 5, 2010, 10:40:38 AM5/5/10
to
Hello

I have a COM - C# question. If I register an object to the ROT (Running
Object Table) that was written in C#, can a C# client get access to that
object?

I know it is impossible to create a COM server in C# that can be accessed by
C# apps as if it was written in a native language, this is why I ask.

Thank you,
Jozsef


Igor Tandetnik

unread,
May 5, 2010, 10:49:16 AM5/5/10
to

Jozsef Bekes <bjd...@hotmail.com> wrote:
> I have a COM - C# question. If I register an object to the ROT
> (Running Object Table) that was written in C#, can a C# client get
> access to that object?

The whole point of COM is that neither the client nor the server need to care what language the other party is written in. It's a binary standard.

> I know it is impossible to create a COM server in C# that can be
> accessed by C# apps as if it was written in a native language

I'm not sure what you mean by a "native language" here. Usually, the term "native" is used as an opposite of "managed" - thus, C++ is a native language (compiled directly to machine code) while C# is a managed language (compiled to intermediate language and executed by .NET runtime). But you don't seem to be using the word in this sense.

Again, COM clients access COM servers in the same way regardless of which language either of them is written in.
--
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

Jozsef Bekes

unread,
May 5, 2010, 11:10:45 AM5/5/10
to
HI Igor,

Thank you for your answer.

I have asked this question ages ago :-) and this was the answer:

"You seem to refer to a .tlb file from within VS, this .tlb file can only be
used by native COM clients only (VB, Delphy, C++ ..) , .NET (C#) clients
don't need to reference the typelib, they need a reference to the .NET
assembly , unfortunately this can't be done from within VS for .exe
assemblies. One option is to run the compiler from the command line, this
one allows you to refer to .exe assemblies (csc /r:yourAssembly.exe .....),
but much better would be to split the .exe into separate components."

http://bytes.com/topic/c-sharp/answers/273295-com-server-net

The way I understood this answer at the time was that there is a difference
between native and managed clients.

Yes, I understand the difference between native and managed code, and you
did answer my question, thank you!

Best regards,
Jozsef


"Igor Tandetnik" <itand...@mvps.org> wrote in message
news:uizMkIG7...@TK2MSFTNGP06.phx.gbl...

Igor Tandetnik

unread,
May 5, 2010, 11:35:30 AM5/5/10
to
Jozsef Bekes <bjd...@hotmail.com> wrote:
> Thank you for your answer.
>
> I have asked this question ages ago :-) and this was the answer:
>
> "You seem to refer to a .tlb file from within VS, this .tlb file can
> only be used by native COM clients only (VB, Delphy, C++ ..) , .NET
> (C#) clients don't need to reference the typelib, they need a
> reference to the .NET assembly

.NET clients can use a TLB - see tlbimp (and, for good measure, tlbexp):

http://msdn.microsoft.com/en-us/library/tt0cf3sx.aspx
http://msdn.microsoft.com/en-us/library/hfzzah2c.aspx

0 new messages