|
We've just started doing a couple MC++ projects at work using VS .NET 2003 everything for the most part seems to be great but all of us have noticed a huge delay when running the program in visual studio (Hitting F5). This delay does not occur when double clicking the program and running it. Anyone know if there is a way to fix this?
|
|
|
|
|
When you hit f5 your are running the debugger. Hit ctrl+f5 (runs without the debbuger) and it should be a lot faster.
|
|
|
|
|
Yipeee... just had a play making Visual Studio 6 IDE pick up the new Visual C++ Express compiler and tried compiling this simple app using the new C++/CLI and straight away it worked.
<br />
#using <System.Windows.Forms.dll><br />
#using <System.dll><br />
#using <System.Drawing.dll><br />
<br />
using namespace System;<br />
using namespace System::Windows::Forms;<br />
<br />
public ref class SimpleHelloWorld : public Form <br />
{<br />
public:<br />
SimpleHelloWorld()<br />
{<br />
Text = "Hello, World.";<br />
}<br />
};<br />
<br />
int main()<br />
{<br />
Application::Run(gcnew SimpleHelloWorld);<br />
}<br />
No intelisense though (as you'd expect)
ade me;
while(myKitchen.beerInFridge()) {
me.watchTV();
me.consumeBeer(myKitchen.getBeerCan());
}
|
|
|
|
|
what is the diffrence between managed C++ and VC++
|
|
|
|
|
|
Managed C++ runs in a virtual machine (very similar to the way java runs) and thus will most likely run slower than native code most of the time but it will provide better security and it also has built-in features that C++ does not have. A garbage collector is one of these features.
John
|
|
|
|
|
IL is compiled to native code before it
is executed. It is not like java byte code
that is interpreted.
Thank You
Bo Hunter
|
|
|
|
|
The same happens with most java virtual machines but this can in no means be as optimized as real native code because it would take much longer for to do the compile.
John
|
|
|
|
|
I'm trying to figure out how to wrap an existing (Unmanaged C++) COM Object in Managed C++ for use in .Net.
I've seen several examples both here in Code Project in MSDN. The examples I've seen so far aren't exactly the solution I've been looking for.
1) Wrap the underlying C++ Object in managed C++ and do away with COM entirely (this will probably give the best performance). This is unacceptable to the client, as they want to maintain the COM interface going forward
2) COM Interop via Managed C++, using TlbImp to import the type library from an unmanaged COM object, then including the generated METADATA inside the the client, and calling the desired interfaces.
We've already taking a crack at this, by generating the original definitons in a CLR assembly, thenediting the intermediate code/stubs to try to fix up any marshalling issues. We found our data types weren't totally compliant with automation (too complex/nested). It would require a lot of trial and error tricky editing in order to get this approach to work (if we could get it to work 100% at all).
3) Rewrite the COM Object in C#. This approach would be resource and cost prohibitive.
So the approach, we would like to take is to write a .NET wrapper, using Managed C++ on top of the COM Object. I've spent a fair amount of time searching the web and other resources for information regarding this approach. I've seen several articles referring to it, but as of yet I have not seen any (simplified) concrete examples of how to go about implementing this solution.
Is there anyone out there who is familiar with this?
A small/simple code example would get me well on the way.
Thanks in advance for your help,
JohnB
|
|
|
|
|
This is such an excellent question, I'm amazed that no one replied.
From the sound of it, you undoubtedly know alot more about this subject than I do. I've recently been reading, ".NET and COM: The Complete Interoperability Guide", by Adam Nathan. Everything I know, I learned from this book. And, I'm very new at it, but, it's a great book.
As you probably already know, the Runtime Callable Wrapper that the Type Library Importer generates is essentially what you would want to create for your COM objects. Your problem is the sheer complexity of the original DLL.
But, the obvious question is: Why must you wrap the COM objects in managed code? There really is no such thing as "pure .NET". (After all, .NET calls the underlying Win32 functions just like everything else.) I'm guessing that you will eventually want to create an application suite for the upcoming 64-bit operating system.
In Adam Nathan's book, there is a section towards the end where he describes manually defining COM types in source code. .NET compilers can produce metadata and IL, which is what the type library importer produces.
Unfortunately, I have no practical experience with this, but, I would guess it is a very time-consuming process, and the potential for systemic errors would be huge.
|
|
|
|
|
simple question, how do I make the computer beep from my managed c++ application. I've been looking a MessageBeep and Beep which both need the windows base class to work. However, I can't get either to work. Any replies would be greatly appreciated. Thanks
|
|
|
|
|
try:
#include <iostream.h>
int main()
{
cout << '\a';
}
if that's what you mean..
bye
|
|
|
|
|
I'm using the new Visual C++ Express beta and when I try to compile a file containing this code:
int fileLength = binRead->ToString()->Length;
array<Byte>^ sendFile = gcnew array<Byte>(fileLength);
I get the following errors:
error C2065: 'array' : undeclared identifier
error C2275: 'System::Byte' : illegal use of this type as an expression stdafx.cpp : see declaration of 'System::Byte'
error C2065: 'sendFile' : undeclared identifier
error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?)
error C2061: syntax error : identifier 'array'
From several articles i've read it seemed to me as though I was declaring the array in the proper manner, however can anyone give me a hand with this? Could the error possibly be elsewhere in my code?
[Edit]I know when declaring native arrays the length must be a constant, is that also the case with C++/CLI Arrays?
|
|
|
|
|
BrianOlej wrote:
error C3192: syntax error : '^' is not a prefix operator (did you mean '*'?)
If the compiler does not recognize that operator it might indicate that you do not of the project configured properly for managed extensions.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
I would have to have rethought my entire life if that was the problem. Naw, when I comment out the arrays the rest of the managed code compiles fine.
Signature under construction.
|
|
|
|
|
Sorry. Shot in the dark... missed everything and hit myself in the head
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
#using <System.dll>
using namespace stdcli::language;
That may help.
Thank You
Bo Hunter
|
|
|
|
|
Perfect! Thank you, it solved my problem.
Signature under construction.
|
|
|
|
|
Interesting..I thought that was automatically imported for every /clr build. Maybe not in beta 1, I guess.
Matt
|
|
|
|
|
Yeah, I thought so as well, I guess not.
Signature under construction.
|
|
|
|
|
I believe mscorlib.dll is the only
automatic import, but I have been
wrong before.
Thank You
Bo Hunter
|
|
|
|
|
How can i repair and compact a Microsoft access database with ADO.NET
Thanks
|
|
|
|
|
I don't know if that is possible. You may have to use the JET engine for those operations.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
What is the difference between Managed C++ and just plain old C++??
Also does managed having anything to do with the whole "Trusted Computing" deal M$ is trying to implement.
Mark
As you journey through life take a minute every now and then to give a thought for the other fellow.
He could be plotting something.
-Hagar the Horrible
|
|
|
|
|