dzÒéC /CLIµÄgcnew¹Ø¼ü×Ö
http://west263.com/info/html/chengxusheji/C-C--/20080224/9240.html
1. gcnew·µ»ØµÄÊǸö¾ä±ú(Handle)£¬¶ønew·µ»ØµÄÊÇʵ¼ÊµÄÄÚ´æµØÖ·.
¡¡¡¡2. gcnew´´½¨µÄ¶ÔÏóÓÉÐéÄâ»úÍйܣ¬¶ønew´´½¨µÄ¶ÔÏó±ØÐë×Ô¼ºÀ´¹ÜÀíºÍÊÍ·Å.
¡¡¡¡µ±È»£¬´Ó³ÌʽԱµÄ½Ç¶ÈÀ´Ëµ£¬¹ÜËûÊǾä±ú»¹ÊÇʲôÆäËûµÄ¶«Î÷£¬×ÜÅܲ»µôÊǶÔij¿éÄÚ´æµØÖ·µÄÒýÓã¬Êµ¼ÊÉÏÎÒÃǶ¼Äܹ»Àí½â³ÉÖ¸Õë.ÏÂÃæÎÒÃǾÍдһ¶Î´úÂëÀ´²âÊÔһϺÃÁË.
using namespace System;
ref class Foo
{
public:
Foo()
{
System::Console::WriteLine("Foo::Foo");
}
~Foo()
{
System::Console::WriteLine("Foo::~Foo");
}
public:
int m_iValue;
};
int _tmain()
{
int* pInt = new int;
int^ rInt = gcnew int;
Foo^ rFoo = gcnew Foo;
delete rFoo;
delete rInt;
delete pInt;
}
Ìرð×¢Ò⣺±¾Õ¾ËùÓÐתÔØÎÄÕÂÑÔÂÛ²»´ú±í±¾Õ¾¹Ûµã£¬±¾Õ¾ËùÌṩµÄÉãÓ°ÕÕƬ£¬²å»£¬Éè¼Æ×÷Æ·£¬ÈçÐèʹÓã¬ÇëÓëÔ×÷ÕßÁªÏµ
¡¡¡¡ÎҰѵ÷ÊÔµÄʱºòJIT±àÒëµÄ»ã±à´úÂëÔñ¼Á˲¿·ÖÈçÏÂÏÔʾ£¨Çë×¢ÒâºìÉ«²¿·Ö£©£º
int* pInt = new int;
0000004c mov ecx£¬4
00000051 call dword ptr ds:[03B51554h]
00000057 mov esi£¬eax
00000059 mov dword ptr [esp 18h]£¬esi
int^ rInt = gcnew int;
0000005d mov ecx£¬788EF9D8h
00000062 call FCFAF66C
00000067 mov esi£¬eax
00000069 mov dword ptr [esi 4]£¬0
00000070 mov edi£¬esi
Foo^ rFoo = gcnew Foo;
00000072 mov ecx£¬3B51768h
00000077 call FCFAF66C
0000007c mov esi£¬eax
0000007e mov ecx£¬esi
00000080 call dword ptr ds:[03B517ACh]
00000086 mov dword ptr [esp 1Ch]£¬esi
delete rFoo;
0000008a mov ebx£¬dword ptr [esp 1Ch]
0000008e test ebx£¬ebx
00000090 je 000000A4
00000092 mov ecx£¬ebx
00000094 call dword ptr ds:[03FD0028h]
0000009a mov dword ptr [esp 14h]£¬0
000000a2 jmp 000000AC
000000a4 mov dword ptr [esp 14h]£¬0
delete rInt;
000000ac mov edx£¬edi
000000ae mov ecx£¬788F747Ch
000000b3 call FC8D20FD
000000b8 mov ebp£¬eax
000000ba test ebp£¬ebp
000000bc je 000000D0
000000be mov ecx£¬ebp
000000c0 call dword ptr ds:[03FD0020h]
000000c6 mov dword ptr [esp 10h]£¬0
000000ce jmp 000000D8
000000d0 mov dword ptr [esp 10h]£¬0
delete pInt;
Ïà¹ØÎĵµ£º
ÉèÖãº
1. Tools/Projects and Solutions/VC ++ Directories
Inlcude files: C:\Program Files\MATLAB\R2009a\extern\include
Library files: C:\Program Files\MATLAB\R2009a\extern\lib
2. Property
Configuration Properties/Linker
......
Ö¸Õë,ÖÚËùÖÜÖª,ʱΪһÄÚ´æµØÖ·.Å׿ªOS¼¶±ð»ò¸üµÍµÄÓ²¼þ¼¶±ð²»Ëµ,½ö¶ÔÓ¦ÓÃÄÚµÄʹÓýøÐÐССµÄÒܲâÌÖÂÛ.
Ê×ÏÈ,ÔÚÓ¦ÓÃÄÚ,ÓÃmallocÉêÇëµ½µÄÒ»¿éµØÖ·Ó¦¸ÃÊÇÁ¬ÐøµÄ(²Â²â,Âß¼ÉÏÁ¬Ðø,ʵ¼ÊÉÏÎïÀíÈçºÎ·Ö²¼²»Óè¹Ø×¢).
Æä´Î,Êý¾Ý´æÔÚÔÚÄÚ´æÖж¼ÊÇÒÔ2½øÖÆÐÎʽ´æ·Å.²»´æÔÚÊý¾ÝÀàÐÍ,Òò´Ë,¶ÔÄÚ´æÊý¾ÝµÄ²Ù×÷,Ö»Òª×ñѽø³öÀàÐÍÒ»Ö¼´¿É.
´ ......
B/S ÊÇ Brower/Server ¾ÍÊÇÓÃä¯ÀÀÆ÷(ÈçIE)ΪӦÓóÌÐò¿Í»§¶Ë²Ù×÷·þÎñÆ÷¡£ÕâÑùÓÃä¯ÀÀÆ÷À´²Ù×÷¼òµ¥Ò×Ó㬵«ÊǶÔÊäÈëûÓкܺõÄÑéÖ¤¡£Â߼ʵÏÖ²»¶à¡£±¾µØÖ»ÊÇÓÃÓÚ»ñÈ¡Êý¾ÝÈ»ºó´ó²¿·ÖÑéÖ¤ÐèÒªÌá½»·þÎñÆ÷À´Íê³É¡£
C/S ÊÇClient/Server ¿Í»§¶ËÈí¼þÔòÊÇÒ»¸öÓµÓкܶàÂß¼ÑéÖ¤µÄÈí¼þ£¬±¾µØÑéÖ¤³É¹¦ºó²ÅÌá½»·þÎñÆ÷¡£
ÎÒÕÒµ½µÄ¸üÏêϸР......
Ò»¡¢³ÌÐòÕæÚÐ
1.³ÌÐò¾ÍÊÇ“°áÊý”
¶¯×÷£º¶ÁÈ¡——¼¼Êõ——д³ö£¨ÊäÈë——´¦Àí——Êä³ö£©
Êý¾Ý½á¹¹¾ö¶¨Êý¾ÝÈçºÎ×éÖ¯£¬°á¶¯ÆðÀ´Ð§Âʽϸß
Ëã·¨ÓïÑÔ¾ ......