Author Topic: COM api  (Read 4899 times)

0 Members and 1 Guest are viewing this topic.

GUIDO ROOMS

  • Guest
COM api
« on: September 12, 2012, 06:58:56 AM »
Is there anybody here who has an idea for how long the com api is going to be around (and usable)?
I don't mean vba here, just the com api proper.
I'm asking since I've got quite some code that is using it and I don't want to rewrite it for the net api if not strictly necessary.

n.yuan

  • Bull Frog
  • Posts: 348
Re: COM api
« Reply #1 on: September 12, 2012, 09:57:30 AM »
IMO, how long COM would stay alive in Windows/AutoCAD may not be your immediate/near future concern. I'd guess Acad COM API will exist as long as COM still lives in Windows.

As far as keep using your existing COM based code/DLL, well, if the DLL is still functional enough to your need. But do consider:

1. if the COM code has been compiled to DLL, is it 32 bit and 64 bit? Most CAD operations have moved or started moving to 64-bit AutoCAD. This would make your 32-bit COM DLLs useless.

2. In most cases the COM DLL would be used inside AutoCAD in conjunction with VBA. With unknown future of VBA (Acad had indicated its death since Acad2010, and being muted these days on this topic), you probably could use it with your NET API project (i.e. set reference to it in COM tab of the reference dailog box). However, even VS could generate its interop wrapper, the COM DLL itself still need to be registered in running computer; while pure .NET DLL can be simply copied and run.

3. If it is the code, not the compiled DLL you want to keep using in your .NET API development, the code still have to be rewritten more or less, depending on how the code was written and what it is to do. Then writing .NET API code, from my experience, would be better choice.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8746
  • AKA Daniel
Re: COM api
« Reply #2 on: September 12, 2012, 11:24:27 AM »
Forever, in fact MS just  developed a whole new language for COM called C++/CX...
COM, the shiny new replacement for .NET  :lol:

GUIDO ROOMS

  • Guest
Re: COM api
« Reply #3 on: September 12, 2012, 03:24:40 PM »
IMO, how long COM would stay alive in Windows/AutoCAD may not be your immediate/near future concern. I'd guess Acad COM API will exist as long as COM still lives in Windows.

That would be enough for me. I'm just using com classes exposed by the com api here and there in my code.
I'm not writing com servers.

Thanks for the reply.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: COM api
« Reply #4 on: September 12, 2012, 04:25:15 PM »
Forever, in fact MS just  developed a whole new language for COM called C++/CX...
COM, the shiny new replacement for .NET  :lol:

I don't think this is a replacement for .NET but a way for C++ programmers to use .NET without having to move to C#.  Just what I thought but I could be wrong too.
Revit 2019, AMEP 2019 64bit Win 10

owenwengerd

  • Bull Frog
  • Posts: 451
Re: COM api
« Reply #5 on: September 12, 2012, 04:41:35 PM »
I don't think this is a replacement for .NET but a way for C++ programmers to use .NET without having to move to C#.  Just what I thought but I could be wrong too.

C++/CX has nothing to do with C# or .NET. You are probably thinking of C++/CLI.

TheMaster

  • Guest
Re: COM api
« Reply #6 on: September 13, 2012, 12:22:39 PM »
Forever, in fact MS just  developed a whole new language for COM called C++/CX...
COM, the shiny new replacement for .NET  :lol:

LOL 

C++/CX is not a replacement for .NET.  You're confusing programming languages with runtimes.

.NET/CLR is a framework/runtime (more speficially, there are now 5 variants of the CLR, including the WinRT subset, Windows Phone 7, Silverlight, the full desktop framework with WPF, and the .NET Compact Framework).

WinRT is a framework/runtime.

C++/CX is an extension to the C++ programming language.

C#, VB.NET, F#, etc. are programming languages.

WinRT is not a replacement for the CLR, it is a sandboxed alternative to .the full CLR that includes a subset of same, which can be used to build apps that can run on any platform that WinRT runs on. You can use many languages to build WinRT apps, including VB, C#, and Javascript.

This might also be worth reading: WinRT Demystified
« Last Edit: September 13, 2012, 12:34:06 PM by TT »

owenwengerd

  • Bull Frog
  • Posts: 451
Re: COM api
« Reply #7 on: September 13, 2012, 02:05:06 PM »
C++/CX is not a replacement for .NET.

You are technically correct, but I think Daniel's tongue-in-cheek point is valid. The C++/CX project exposes a subtle shift away from the .NET principles and back to more traditional pure COM. Couple this with clear indications from Microsoft that the utopian dream of JIT compiled managed code replacing native code was a mirage, and it's not a stretch to see that .NET is losing its sheen in favor of more efficient native code like C++/CX with a tighter coupling to the underlying runtime framework.

BlackBox

  • King Gator
  • Posts: 3770
Re: COM api
« Reply #8 on: September 13, 2012, 02:28:49 PM »
Wait... So should we be self-teching C#/VB.NET, or ObjectARX (C++) for AutoCAD development!?  :?



"How we think determines what we do, and what we do determines what we get."

GUIDO ROOMS

  • Guest
Re: COM api
« Reply #9 on: September 13, 2012, 02:51:20 PM »


Sorry I started this mate.
Didn't mean no harm, you know.
It was just a question, right?

BlackBox

  • King Gator
  • Posts: 3770
Re: COM api
« Reply #10 on: September 13, 2012, 02:59:11 PM »
... No worries; I was actually half-joking when I posed my question (just in case).

/OffTopic
"How we think determines what we do, and what we do determines what we get."

TheMaster

  • Guest
Re: COM api
« Reply #11 on: September 13, 2012, 03:09:55 PM »
Wait... So should we be self-teching C#/VB.NET, or ObjectARX (C++) for AutoCAD development!?  :?



The situation is similar for AutoCAD. There is no .NET on the MAC, so don't expect to see very many new features implemented in managed code.

The new properties palette implementation is one example. It has no dependence on Windows/COM, so it can be used on the MAC.

AutoCAD for Windows users should not be rejoicing at Autodesk's efforts to make AutoCAD's code base more portable, because it will result in something I call the 'java-effect', which means that the finished product is limited to the least-common denominator, and no platform-specific features, no matter how compelling or beneficial they may be to end users, will be tolerated.

Let's hope that Mono for Andriod/Mac/iOS/Linux gains steam, because it's the only hope we have for a rational, modern, cross-platform API that doesn't suffer from what makes Java a stinking, rotting, painfully-slow, bug-infested, malware-friendly pile of garbage.

BlackBox

  • King Gator
  • Posts: 3770
Re: COM api
« Reply #12 on: September 13, 2012, 03:16:04 PM »
Wait... So should we be self-teching C#/VB.NET, or ObjectARX (C++) for AutoCAD development!?  :?



The situation is similar for AutoCAD. There is no .NET on the MAC, so don't expect to see very many new features implemented in managed code.

The new properties palette implementation is one example. It has no dependence on Windows/COM, so it can be used on the MAC.

AutoCAD for Windows users should not be rejoicing at Autodesk's efforts to make AutoCAD's code base more portable, because it will result in something I call the 'java-effect', which means that the finished product is limited to the least-common denominator, and no platform-specific features, no matter how compelling or beneficial they may be to end users, will be tolerated.

Let's hope that Mono for Andriod/Mac/iOS/Linux gains steam, because it's the only hope we have for a rational, modern, cross-platform API that doesn't suffer from what makes Java a stinking, rotting, painfully-slow, bug-infested, malware-friendly pile of garbage.

I always appreciate your insight on these matters, Tony... But it sure would be nice if you weren't so vague, and simply 'picked a side', rather than sitting on the [Java-]fence. 

:-P :-D Cheers! :beer:
"How we think determines what we do, and what we do determines what we get."

TheMaster

  • Guest
Re: COM api
« Reply #13 on: September 13, 2012, 11:35:20 PM »
C++/CX is not a replacement for .NET.

You are technically correct, but I think Daniel's tongue-in-cheek point is valid. The C++/CX project exposes a subtle shift away from the .NET principles and back to more traditional pure COM. Couple this with clear indications from Microsoft that the utopian dream of JIT compiled managed code replacing native code was a mirage, and it's not a stretch to see that .NET is losing its sheen in favor of more efficient native code like C++/CX with a tighter coupling to the underlying runtime framework.

I'm not sure who was having that utopian dream, but I never believed that managed code ever would or could replace native code entirely. It's simply not practical or well-suited for many performance-intensive tasks. That's not what managed code is about. Managed code is about productivity, leveraging and consuming a huge number of APIs (that may be partially or entirely implemented in native code), and allowing the programmer to focus more on domain problems rather than than on managing the heap and the lifetime of their program objects. Also, as computers become increasingly-faster and as JIT technology improves at the rate it has over the last 20 years, the performance advantages of purely-native code become less significant. 20 years ago, native code was the only feasible way to do most things. Today that's no longer the case, and in the future, it will become less essential than it is today. And, the fact that 99 out of 100 users are unable to distinguish between native and managed code makes that idea seem a bit silly.

I also don't think C++/CX represents a shift away from .NET principles. WinRT was designed to be consumed from both native and managed code with full language parity,  and to provide complete interoperability between all supported languages. You can consume WinRT components authored in any supported language, from any other supported language. You can consume components authored in managed code from native code, and visa verse. If you ask me, that is not a shift away from .NET principles. On the contrary, that's a shift towards .NET principles.

About .NET loosing its sheen, I don't think that's the case. Ideally, the full .NET framework would be ported to other platforms, but that's not going to happen, and one of the major reasons why has nothing to do with 'more efficient native code like C++/CX', it is mostly about portability, running in a sandbox with heavily-restricted privileges, and about Windows/Intel-specific dependencies of many .NET APIs, like for example, the dependence that WPF has on DirectX, which is inherently Windows/Intel bound, and will never be ported to any other platform.

There's also many other Windows-specific APIs in .NET that cannot be easily translated to other platforms, and the biggest reason why WinRT does not include the full desktop .NET framework is because it is a sandbox that deliberately restricts access to the underlying system.

If you read the article I posted the link to, you'll see that the CLR is alive and well in Windows 8 and WinRT, but when you want to build WinRT sandbox applications that can be published on the app store, you must use WinRT APIs only, and you must adhere to all of the imposed restrictions.

I don't see what any of that has to do the better performance of C++, with or without the CX extensions. If performance was that important, .NET would never have become as huge as it is today. WinRT and C++/CX are mostly about Microsoft's attempts to realize some traction in the tablet/mobile device market, something they've failed miserably at to date. I predict their strategy of turning every desktop PC into an oversized smartphone will fail miserably. Why? Because Windows users aren't interested in towing Microsoft's line and constantly re-tooling their business processes and their brains, in service to Microsoft's marketing agenda and its history of abysmal failures. If Microsoft already had a major share of the small-format/mobile device market, then turning every desktop PC into a giant smartphone might make sense.

I recall your once labeling .NET a 'fad' that will pass. I think its been more than adequately shown that was simply not the case, and in fact, today, the CLR and standards-based C# are bigger than Microsoft, and they couldn't stall its momentum even if they wanted to.

« Last Edit: September 13, 2012, 11:51:01 PM by TT »

Jeff H

  • Needs a day job
  • Posts: 6150
Re: COM api
« Reply #14 on: September 14, 2012, 12:08:04 AM »
Just to throw in some other viewpoints
 
Here is a little snippet from Jeffrey Richter's book CLR via C#
 
Quote

For those developers coming from an unmanaged C or C++ background, you're probably thinking about the performance ramifications of all this. After all, unmanaged code is compiled for a specific CPU platform, and, when invoked, the code can simply execute. In this managed environment, compiling the code is accomplished in two phases. First, the compiler passes over the source code, doing as much work as possible in producing IL. But to execute the code, the IL itself must be compiled into native CPU instructions at runtime, requiring more memory to be allocated and requiring additional CPU time to do the work.
 
Believe me, since I approached the CLR from a C/C++ background myself, I was quite skeptical and concerned about this additional overhead. The truth is that this second compilation stage that occurs at runtime does hurt performance, and it does allocate dynamic memory. However, Microsoft has done a lot of performance work to keep this additional overhead to a minimum.
 
If you too are skeptical, you should certainly build some applications and test the performance for yourself. In addition, you should run some nontrivial managed applications Microsoft or others have produced, and measure their performance. I think you'll be surprised at how good the performance actually is.
 
You'll probably find this hard to believe, but many people (including me) think that managed applications could actually outperform unmanaged applications. There are many reasons to believe this. For example, when the JIT compiler compiles the IL code into native code at runtime, the compiler knows more about the execution environment than an unmanaged compiler would know. Here are some ways that managed code can outperform unmanaged code:
 
  • A JIT compiler can determine if the application is running on an Intel Pentium 4 CPU and produce native code that takes advantage of any special instructions offered by the Pentium 4. Usually, unmanaged applications are compiled for the lowest-common-denominator CPU and avoid using special instructions that would give the application a performance boost.
 
 
  • A JIT compiler can determine when a certain test is always false on the machine that it is running on. For example, consider a method that contains the following code: if (numberOfCPUs > 1) {  ... } This code
This code could cause the JIT compiler to not generate any CPU instructions if the host machine has only one CPU. In this case, the native code would be fine-tuned for the host machine; the resulting code is smaller and executes faster.
 
 
  • The CLR could profile the code's execution and recompile the IL into native code while the application runs. The recompiled code could be reorganized to reduce incorrect branch predictions depending on the observed execution patterns. Current versions of the CLR do not do this, but future versions might. These are only a few of the reasons why you should expect future managed code to execute better than today's unmanaged code. As I said, the performance is currently quite good for most applications, and it promises to improve as time goes on. If your experiments show that the CLR's JIT compiler doesn't offer your application the kind of performance it requires, you may want to take advantage of the NGen.exe tool that ships with the .NET Framework SDK. This tool compiles all of an assembly's IL code into native code and saves the resulting native code to a file on disk. At runtime, when an assembly is loaded, the CLR automatically checks to see whether a precompiled version of the assembly also exists, and if it does, the CLR loads the precompiled code so that no compilation is required at runtime. Note that NGen.exe must be conservative about the assumptions it makes regarding the actual execution environment, and for this reason, the code produced by NGen.exe will not be as highly optimized as the JIT compiler–produced code. I'll discuss NGen.exe in more detail later in this chapter.