.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

can net and com api live in same module?

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
336 Views, 6 Replies

can net and com api live in same module?

I read about how 'interchangable' all the dot net languages are
can lines of code calling com and lines of code calling net be in same
module?
can C# be in same module with vbnet?
thanks
mark
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

you could start here
http://www.velocityreviews.com/forums/t20282-how-to-have-multiple-language-sources-in-one-project.html

"mp" wrote in message
news:6309327@discussion.autodesk.com...
I read about how 'interchangable' all the dot net languages are
can lines of code calling com and lines of code calling net be in same
module?
can C# be in same module with vbnet?
thanks
mark
Message 3 of 7
Anonymous
in reply to: Anonymous

Thanks, will check that out
Mark

"Kerry Brown" wrote in message
news:6309314@discussion.autodesk.com...
you could start here
http://www.velocityreviews.com/forums/t20282-how-to-have-multiple-language-sources-in-one-project.html

"mp" wrote in message
news:6309327@discussion.autodesk.com...
I read about how 'interchangable' all the dot net languages are
can lines of code calling com and lines of code calling net be in same
module?
can C# be in same module with vbnet?
thanks
mark
Message 4 of 7
chiefbraincloud
in reply to: Anonymous

First, yes. COM code and Managed code (they are both .NET, if you use the .NET framework to access them) can live in the same module, but from my experience, you have to be pretty careful about mixing the two.
I had a VBA project that I upgraded from LSP in '05. Then when I finally got my company to get me Visual Studio, I converted the code over in the quickest way possible, which was all COM. Once I finished that, I started to convert things from COM to Managed. During the process while I had some things converted and others not, I experienced various unexpected instabilities of the fatal variety.

My advice is to keep the two seperate, as in don't go trying to use COM on an object you have open in a transaction or vice versa. Do the COM stuff in one sub, and the transaction stuff in another. Both Subs could be in the same module. And technically, it could all be one function, if written correctly with the transaction separated from the COM access.

And just as important, my advice is to eventually get everything converted to Managed code. I finally accomplished this early '08, and ultimately, once I got everything figured out, the performance and stability of my program were greatly improved.

Second C# and VB (or anything else J#, C++, F#, etc...) can NOT live in the same module, or class, but you can have multiple languages in your project by building seperate assemblies and referencing them. eg. build all the C# code into a .DLL and reference that into your VB project.
Dave O.                                                                  Sig-Logos32.png
Message 5 of 7
Anonymous
in reply to: Anonymous

Thanks for the info
mark

wrote in message news:6309733@discussion.autodesk.com...
First, yes. COM code and Managed code (they are both .NET, if you use the
.NET framework to access them) can live in the same module, but from my
experience, you have to be pretty careful about mixing the two.
I had a VBA project that I upgraded from LSP in '05. Then when I finally
got my company to get me Visual Studio, I converted the code over in the
quickest way possible, which was all COM. Once I finished that, I started
to convert things from COM to Managed. During the process while I had some
things converted and others not, I experienced various unexpected
instabilities of the fatal variety.

My advice is to keep the two seperate, as in don't go trying to use COM on
an object you have open in a transaction or vice versa. Do the COM stuff in
one sub, and the transaction stuff in another. Both Subs could be in the
same module. And technically, it could all be one function, if written
correctly with the transaction separated from the COM access.

And just as important, my advice is to eventually get everything converted
to Managed code. I finally accomplished this early '08, and ultimately,
once I got everything figured out, the performance and stability of my
program were greatly improved.

Second C# and VB (or anything else J#, C++, F#, etc...) can NOT live in the
same module, or class, but you can have multiple languages in your project
by building seperate assemblies and referencing them. eg. build all the C#
code into a .DLL and reference that into your VB project.
Message 6 of 7
Anonymous
in reply to: Anonymous

You can freely mix COM and .NET API calls in the same code, with some
restrictions.

See the topic "Mixing the Transaction Model with the Open and Close
Mechanism" in the native ObjectARX Developer Guide.

The COM API uses the 'open and close mechansim' as it is referred to in that
topic, so anything that applies to the open and close mechanism applies to
the COM API as well.

Different .NET languages cannot appear in the same module. A module is a
component of an assembly (an assembly can contain multiple modules, but
that's quite uncommon), so you can mix code written in different langauges
within the same assembly, but can't do that using the IDE. You must use
command line tools, or ILMERGE (google it).

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6309327@discussion.autodesk.com...
I read about how 'interchangable' all the dot net languages are
can lines of code calling com and lines of code calling net be in same
module?
can C# be in same module with vbnet?
thanks
mark
Message 7 of 7
Anonymous
in reply to: Anonymous

Thanks
mark

"Tony Tanzillo" wrote in message
news:6309886@discussion.autodesk.com...
You can freely mix COM and .NET API calls in the same code, with some
restrictions.

See the topic "Mixing the Transaction Model with the Open and Close
Mechanism" in the native ObjectARX Developer Guide.

The COM API uses the 'open and close mechansim' as it is referred to in that
topic, so anything that applies to the open and close mechanism applies to
the COM API as well.

Different .NET languages cannot appear in the same module. A module is a
component of an assembly (an assembly can contain multiple modules, but
that's quite uncommon), so you can mix code written in different langauges
within the same assembly, but can't do that using the IDE. You must use
command line tools, or ILMERGE (google it).

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

"mp" wrote in message
news:6309327@discussion.autodesk.com...
I read about how 'interchangable' all the dot net languages are
can lines of code calling com and lines of code calling net be in same
module?
can C# be in same module with vbnet?
thanks
mark

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost