|
The CLR takes care of the removing the unrefernced objects in the case of managed code
While in the case of unmanaged code u should make sure u dispose them
sathy
|
|
|
|
|
i'm not a MC++ expert, but here are the facts.
every program compiled to run on the .NET framework is not compiled in native language (directly for the microprocessor) but into an intermediate language called MSIL (Microsoft Intermediate Language). Then, at the first execution of the program, its final compilation into native is executed BY the framework, so that the same program can be run either on whatever plateform that have the .NET framework running...
it is exactly the same as java does with its Byte-Code intermediate language and its JVM/JRE (java virtual machine/Java runtime environment).
there are several languages purely oriented .NET such as C# or VB.NET, and C++ has been implemented too (with several differences in the syntax also) within the new Managed C++ language, also refered to as C++/CLI...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Some applications, during run-time, require dynamic memory allocations to do the required data processing. If these allocations of memory are not returned to the operating system before the application terminates, no other application can reallocate this memory (this is known as a "memory leak"). With unmanaged code, it is the responsibility of the developer to deallocate memory before application expected or unexpected termination. With managed code, memory deallocation is taken care of by a process called Garbage Collection (GC). The GC process reduces the developer's burden of managing memory.
|
|
|
|
|
hi:
hey guys, how do you load the resource.resx to get the string in managed C++?
thanks
|
|
|
|
|
I'm just off the wikipedia site, reading on the concept of CLI, bytecode, JIT, Managed C++, etc. It jdawns on me that Microsoft's .NET Framework( still a key part of VS 2005)makes C++ no longer a precompiled Lan tool anymore! The C++ code is precompiled by .NET engine to bytecode, which is transmitted to the user, then translated into machine code by .NET virtual machine on the users's computer, just before runtime. (Just In Time-- JIT)
This is exactly like what Java does. So .NET Framework makes C++ like Java?
Here is my question, if .NET Framework makes C++ portable now, why bother with C#? to create web, ADO.NET, and ASP.NET applycations?
Can I stay with C++ to creat a powerful ASP.Net apps? Do you have weblinks talking about this subject?
Thanks
|
|
|
|
|
read this[^] first.
larryfran wrote: if .NET Framework makes C++ portable now, why bother with C#? to create web, ADO.NET, and ASP.NET applycations?
C++ is .NET independant. only C++/CLI compiles for .NET framework.
C# only makes .NET applications, so that you cannnot make native builds with it (when C++ can still do them if not in managed mode).
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
Microsoft does not make it easy to create web applications in Managed C++ or C++/CLI. I don't advise using Managed C++ to create web applications or supporting assemblies using Microsoft .NET framework 1.0 or 1.1 due to the problems associated with Loader Lock. Nevertheless, writing C++/CLI assemblies for C#/VB web applications is a legit option.
|
|
|
|
|
A file is selected in explorer. I am able to get the selected file info using listview class "SysListview23". Now i want to get the selected file full path. SHGetPathFromIDList is not returning the full path. It is returning the path respective of desktop folder. How to get the full path of the selcted file/folder?
Please help me
Thanks,
Arumugarani Sundaram
|
|
|
|
|
Hello,
I was able to call native overridden virtual function (with no parameters) using polymorphism between Managed and Native C++ via a native DLL (compiled by VC6 compiler). I tried to extend this sample by adding one managed parameter of type structure to the native virtual function. VC6 compiler compiled the sources and generated lib/dll for the new changes successfully.
class ADPCBIJW_API AdpCBBase
{
public:
AdpCBBase(){}
//virtual void notify(gcroot<startsqnotiinfo *=""> apInfo)=0;
virtual void notify(StartSQNotiInfo * apInfo)=0;
virtual void notify()=0;
};
However, I noticed below compilation error while trying to compile MC++ client using the native header with the above declaration:
error C3383: 'AdpCBBase::notify' : in an unmanaged class, a virtual member function cannot have a managed type in the signature
I read the explanation for this in MSDN. And found some articles on google stating this feature is prohibited due to performance overheads with the involved transistions from managed-native-managed. But do you know any alternative to get around this problem?
One alternative may be by using gcroot template around the managed type in the native function. This might work with VC7 compiler to generate lib/dll when compiled with CLR option. But how can this work with VC6 compiler for it unaware of gcroot, vcclr.h, mscorlib.dll and /clr option?
How to make this work between VC6 compiler and MC++ compiler?
ps:- Another question, Does gcroot support pointer to a managed structure also?
Thank you & Best Regards,
-- modified at 13:27 Tuesday 24th January, 2006
|
|
|
|
|
Hello ! I am bit confused of allocation of __gc struct arrays, so
I have the following declaration and allocation:
__gc struct MethodTableEntry {<br />
<br />
String* MethodName;<br />
String* ParamName;<br />
};<br />
<br />
<br />
MethodTableEntry *MethodTable[]=__gc new MethodTableEntry*[MethodNumber];
Now I want that ParamName should be an array of 7 strings.
Ex. i want to use the following
MethodTable[1].ParamName[2]=S"This is the 2nd Param of Method No1";
So how can I allocate these string arrays ? I tried a lot, but now I am tired of hunting the proper syntax.
Thanx
|
|
|
|
|
I understand that the equivalent for __gc in VC++ 2005 is ref keyword. Similarly can anyone update me on the equivalent for __gc* in VC++ 2005.
Thanks in advance
Thanks and Regards
Madhu
|
|
|
|
|
madhusri wrote: I understand that the equivalent for __gc in VC++ 2005 is ref keyword. Similarly can anyone update me on the equivalent for __gc* in VC++ 2005.
Thanks in advance
I answered this in the MS forum too. But since you've posted here, and since others may have the same question in future, here's the answer once again :-
A^ a = gcnew A();
The A^ is a handle to the managed object A (similar to __gc* in MC++)
Regards,
Nish
|
|
|
|
|
Sivakumar,
Thanks for your response. I had actually tried with this option earlier. But then i did not get the problem solved. May be i'll try explaning you what i actually need with this code segment so that you can help me out.
The objective is i have to access a dll through C# code. The dll is created from VC++ code. In the C# code i need to pass the address as the function argument. In VS 2003 i could achieve it through the following C++ code segment:
public:void GetIntReturn(int __gc* ivalue)
{
*ivalue=10;
}
Here's the C# code segment calling the corresponding function.
public int GetValueFromC++()
{
int i =0;
GetIntReturn(ref i)
return i;
}
This work fine and this is what i want.
But now i got to do the same using VS2005. As you said earlier i tried replacing __gc* with ^. But when invoking this function in C# it asks me for value type and not reference type. Can you help me out with this please.
Thanks and Regards
Madhu
|
|
|
|
|
Ah ok, the C++/CLI equivalent for that is
void GetIntReturn(int% ivalue)
{
ivalue = 10;
}
Regards,
Nish
|
|
|
|
|
Sivakumar,
Thanks for your response. This worked out well for me.
Thanks and Regards
Madhu
|
|
|
|
|
Thanks we got an idea. but this doesn't work on class ,string and structures
how can this be used for those data types
Regards
Srini
|
|
|
|
|
Sriinii wrote: Thanks we got an idea. but this doesn't work on class ,string and structures
In what way does it not work?
Regards,
Nish
|
|
|
|
|
You have to do the following:
<br />
void GetStringReturn(String^% stringValue)<br />
{ <br />
stringValue = "10"; <br />
}<br />
-- modified at 14:59 Friday 3rd February, 2006
|
|
|
|
|
This is gr8 it is working for me.
Thanks George, Nishant.
Thank u very much
Regards,
Srini
|
|
|
|
|
Does anybody know how to get share permissions?
Kelvin Chikomo
|
|
|
|
|
How to convert binary file to text file in C++?
Premalatha
|
|
|
|
|
What do you mean by this ?
You mean converting an executable (which is a binary file) into a text file for example ?
And what do you mean also by text file ? Something like transforming your binary file into source file or something like that ? (that is not possible, or not easily at least...)
-- modified at 2:55 Tuesday 24th January, 2006
By the way, this is the forum for managed and not the C++ forum. You should post in the future in the Visual C++ forum because your question is purely related to C++
|
|
|
|
|
Could You be more specific, pls ?
What type of binary file u have, and what info is stored in it ?, etc ...
|
|
|
|
|
This program converts a .bin to a readable file but it also increase the overall size(not good) any help or ideas.
#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int _tmain()
{
unsigned char a1[16];
unsigned char a2[16];
unsigned int tempWRITE;
//FILE *in = fopen("c:/test.bin","r");
FILE *in = fopen("c:/test.bin","rb");
FILE *out = fopen("c:/new.txt","w");
while(!feof(in)) {
fread(a1,1,16,in);
a2[0] = a1[3];
a2[1] = a1[2];
a2[2] = a1[1];
a2[3] = a1[0];
a2[4] = a1[5];
a2[5] = a1[6];
a2[6] = a1[4];
a2[7] = a1[7];
a2[8] = a1[9];
a2[9] = a1[11];
a2[10] = a1[8];
a2[11] = a1[10];
a2[12] = a1[14];
a2[13] = a1[12];
a2[14] = a1[15];
a2[15] = a1[13];
fwrite(a2,1,16,out);
}
fclose(in);
fclose(out);
return 0;
}
1. Out of clutter, find simplicity.
2. From discord, find harmony.
3. In the middle of difficulty lies opportunity.
Albert Einstein
three rules of work
|
|
|
|
|
Hi all....
Maybe you all think this is a silly question, but this problem really disturbing me. The problem is set default namespace for multiple class file. The problem is like this :
at the first file i type :
namespace NSA {
namespace NSB {
//Class statement here.
}
}
The problem came when we create a multiple class file (using Project->Add Class menu) but have same namespace like above. Old way is I type the namespace structure like above in every file. Then i thinking if i create more then 10 class file then i must type the same namespace for 20 times (so you know what will came if we create 3 or more namespace level).
I found in the project properties window (not the pop up) the property call "Root Namespace", I have set up like this "NSA" then in evey file i only type namespace "NSB". But then in the object browser only came the "NSB" namespace. (Doesn't help anyway i think).
Please reply soon, OK.
Thanks for help of you all.
|
|
|
|