473,327 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Is it posible to create COM in .Net C#

Hai
I want to create a COM in C# .Net, is it posible to create a COM in C#
Net, if how can we create a COM in C# .Net.
Regards
S.Vinodh Noel
(Bangalore)

Nov 17 '05 #1
11 1212
"chinthamani" <vi*********@yahoo.com> wrote in message
news:d2******************************@localhost.ta lkaboutsoftware.com...
Hai
I want to create a COM in C# .Net, is it posible to create a COM in C#
Net, if how can we create a COM in C# .Net.


..Net types can be exposed to COM. MSDN is your friend.

http://msdn2.microsoft.com/en-us/library/kfzsfkz3

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Nov 17 '05 #2
Hello

You can try to use Regasm to allow COM clients instantiate your .NET
classes:
http://msdn2.microsoft.com/en-us/library/tzat5yw6

--
With best regards,
Andrew

http://www.codeproject.com/script/pr...asp?id=1181072
"chinthamani" <vi*********@yahoo.com> wrote in message
news:d2******************************@localhost.ta lkaboutsoftware.com...
Hai
I want to create a COM in C# .Net, is it posible to create a COM in C#
Net, if how can we create a COM in C# .Net.
Regards
S.Vinodh Noel
(Bangalore)

Nov 17 '05 #3
> I want to create a COM in C# .Net, is it posible to create a COM in C#
Net, if how can we create a COM in C# .Net.

Yes, but the .NET must be installed in order to run those COM components.
Nov 17 '05 #4
apm

"chinthamani" <vi*********@yahoo.com> wrote in message
news:d2******************************@localhost.ta lkaboutsoftware.com...
Hai
I want to create a COM in C# .Net, is it posible to create a COM in C#
Net, if how can we create a COM in C# .Net.
Regards
S.Vinodh Noel
(Bangalore)
Building COM components with .NET is tricky business. Components need
_strong names_ and must be placed in the GAC. After all that they won't run
on older computers. It would be great if C# could be used to make _native_
COM components. I suspect it is possible in _unsafe_ mode with a very large
amount of work.

The last time I made .NET components and exposed them to COM the app ran
very slowly. What can cause this and has the performance improved? I used
version 1.0.

David

Nov 17 '05 #5
You can create a COM wrapper with tlbexp.exe, but the code will still require
the .NET platform to run. As a shortcut regasm.exe allows you to create the
wrapper and register it.

You can also reduce the footprint of .NET with this:
http://www.remotesoft.com/linker/index.html

You will still have to have parts of the Framework, however. And, I am not
sure how this bodes with Microsoft. Either way, you will have to create a COM
wrapper.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"chinthamani" wrote:
Hai
I want to create a COM in C# .Net, is it posible to create a COM in C#
.Net, if how can we create a COM in C# .Net.
Regards
S.Vinodh Noel
(Bangalore)

Nov 17 '05 #6

"apm" <Co*********@AdsorptionProcessModeling.com> wrote in message
news:iaVVe.7537$nq.1127@lakeread05...

"chinthamani" <vi*********@yahoo.com> wrote in message
news:d2******************************@localhost.ta lkaboutsoftware.com...
Hai
I want to create a COM in C# .Net, is it posible to create a COM in C#
Net, if how can we create a COM in C# .Net.
Regards
S.Vinodh Noel
(Bangalore)
Building COM components with .NET is tricky business.

No, it's not. Actually it's just as simple to build COM components in .NET
than it is in VB6 f.i. The only tricky thing is to keep an eye on the
requirements imposed by COM.

Components need _strong names_ and must be placed in the GAC. After all that they won't
run on older computers. Not true, your private assemblies do't have to be signed and they don't have
to be in the GAC. Public assemblies can better be signed (but this is not
imposed), but don't have to be in the GAC either, you can register them
using the /codebase option.

It would be great if C# could be used to make _native_ COM components. I suspect it is possible in _unsafe_ mode with a very
large amount of work.
C# is targetting a managed environment, building native code is not what it
was designed for, so building native COM was certainly not why .NET was
invented for, why should it, there are still tools arround to build native
COM (C++, VB6, Delphi, ...).
Building native COM using "unsafe mode" is NOT possible, unsafe doesn't mean
native.
The last time I made .NET components and exposed them to COM the app ran
very slowly. What can cause this and has the performance improved? I used
version 1.0.


Transitioning between managed/unmanaged code has some overhead, but when
done correctly , this overhead is negligible.
Willy.
Nov 17 '05 #7
Search msdn for EnterpriseServices

in MSDN

You can start here
http://msdn.microsoft.com/library/de...ntoverview.asp
"chinthamani" <vi*********@yahoo.com> wrote in message news:d2******************************@localhost.ta lkaboutsoftware.com...
Hai
I want to create a COM in C# .Net, is it posible to create a COM in C#
Net, if how can we create a COM in C# .Net.
Regards
S.Vinodh Noel
(Bangalore)

Nov 17 '05 #8
apm

The last time I made .NET components and exposed them to COM the app ran
very slowly. What can cause this and has the performance improved? I
used version 1.0.
Transitioning between managed/unmanaged code has some overhead, but when
done correctly , this overhead is negligible.


Sometimes the overhead is negligible. Sometimes it is not negligible. It
turns out that some of the most efficient means of transfering information
among COM components is very inefficient when a COM component transfers that
information to a .NET component. Sometimes this is not important. Sometimes
it is important. Sometimes the only way to do it "correctly" involves
writting a lot of "unsafe" code.


Willy.

Nov 17 '05 #9

"apm" <Co*********@AdsorptionProcessModeling.com> wrote in message
news:9KiWe.8141$nq.6715@lakeread05...

The last time I made .NET components and exposed them to COM the app ran
very slowly. What can cause this and has the performance improved? I
used version 1.0.


Transitioning between managed/unmanaged code has some overhead, but when
done correctly , this overhead is negligible.


Sometimes the overhead is negligible. Sometimes it is not negligible. It
turns out that some of the most efficient means of transfering information
among COM components is very inefficient when a COM component transfers
that information to a .NET component. Sometimes this is not important.
Sometimes it is important. Sometimes the only way to do it "correctly"
involves writting a lot of "unsafe" code.


Unsafe code relates to the usage of pointers in C# to speed-up array
accesses, but this has nothing to do with COM interop. COM interop is fully
integrated in the CLR which takes care of parameter marshaling and interface
marshaling when cross-apartment calls are involved, and it's this marshaling
that takes time. Now, if you take care that COM objects live in the callers
apartment and if you turn-off the security checks performed when calling
into COM or from COM, the call overhead is some 30 instructions per call
(~10-15 nsec. on entry type PC ), this is what I call negligible.

Willy.
Nov 17 '05 #10
apm

What security checks are there and how can they be turned off?

When an array of 10,000 double is passed from COM to .NET it is copied
(passed by value). In order to make it behave like an array passed by
reference the array is copied again when control returns to COM. COM
components all running in the same process will pass arrays by passing a
reference. This takes very little time because one pointer is passed. When
COM passes to .NET 10,000 doubles are copied twice unless the default
marshaling is overridden.
Now, if you take care that COM objects live in the callers apartment
I'd like to know how to run a COM object in a .NET object's appartment.

and if you turn-off the security checks performed when calling into COM or from COM, the call overhead is some 30 instructions per call
(~10-15 nsec. on entry type PC ), this is what I call negligible.

Willy.

Nov 17 '05 #11

"apm" <Co*********@AdsorptionProcessModeling.com> wrote in message
news:1nCWe.11753$nq.2460@lakeread05...

What security checks are there and how can they be turned off?

When an array of 10,000 double is passed from COM to .NET it is copied
(passed by value). In order to make it behave like an array passed by
reference the array is copied again when control returns to COM. COM
components all running in the same process will pass arrays by passing a
reference. This takes very little time because one pointer is passed. When
COM passes to .NET 10,000 doubles are copied twice unless the default
marshaling is overridden.
Now, if you take care that COM objects live in the callers apartment


I'd like to know how to run a COM object in a .NET object's appartment.

and if you turn-off the security checks performed when calling
into COM or from COM, the call overhead is some 30 instructions per call
(~10-15 nsec. on entry type PC ), this is what I call negligible.

Willy.


You can apply:
[System.Security.SuppressUnmanagedCodeSecurity]
in order to suppress a security walk when calling into COM (or unmanaged
code) , note that this is not relevant when calling into .NET as unmanaged
code knows nothing about code access security.

Array's are always copied when calling into .NET from COM, see your other
thread for a more detailed answer.

Willy.
Nov 17 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: | last post by:
hey all, i wonder if it is posible to make a A:HOVER without a class defintion.. so <a href="#" style="{color:red;};HOVER{color:blue}">test</a> because i am sending html email in the body ...
0
by: Banx | last post by:
Hi everyone, i'm trying to copy data from a table in Pervasive database to a table in MySQL Does anyone know how to do it? :confused: Is it posible to copy data from another database prog to...
17
by: David Scemama | last post by:
Hi, I'm writing a program using VB.NET that needs to communicate with a DOS Pascal program than cannot be modified. The communication channel is through some file databases, and I have a huge...
2
by: Sergei | last post by:
Hello everybody, I need to validate an XML document with a DTD file. The problem is that <lang> tag is empty some times, (but it should contain ENG,RUS,SPA...) which causes en error later in the...
1
by: Grzegorz ¦lusarek | last post by:
Hi All. One of the fields used in my form is to upload file, Is is to posible to made this field readonly and after filling radio field set this to use by javascript. I don't wanna give a User...
9
by: mtczx232 | last post by:
it's posible that Function return byref? what the syntax?
2
by: cleelakumar | last post by:
helloo.., i am leela kumar. my problem is if any file can be explor view in vb.net 1.1, let me known if any processs,any code. plz slove the problem hi all, i have a small problem.Can I open...
4
by: MyMarlboro | last post by:
Is it posible to append to txt file vertically??? Example original file... (constants: A, B , C, Car, Boat) BLANK, Car, BLANK, Boat, BLANK BLANK, Nov07, Dec07, Nov07, Dec07 A, 1, 2, 2, 7,...
0
by: Nomen Nescio | last post by:
hay, student proggramer 19 yrs old china in computer course ben doing c proggraming cpl of months from pascal backgrond enjoyying c unleashed book posible minour buggs found in dick heathfields...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.