Visual C++ Runtime: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
No edit summary
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(3 intermediate revisions by 3 users not shown)
Line 5:
This code will help to call all constructors for global static variables.
 
<sourcesyntaxhighlight lang="c">// Constructor prototypes
typedef void (__cdecl *_PVFV)(void);
typedef int (__cdecl *_PIFV)(void);
Line 77:
_initterm(__xc_a, __xc_z);
return true;
}</sourcesyntaxhighlight>
 
 
Line 83:
One of the first things you'll want to do is implement new and delete operators. At first, you can't really implement them, and just need to have their stubs. Later on, when you get your memory manager working, you can fully implement them. Bellow are the stubs:
 
<sourcesyntaxhighlight lang="C">void* __cdecl operator new(size_t size)
{
// Allocate memory
Line 113:
 
// Release allocated memory
}</sourcesyntaxhighlight>
 
 
If you'll want to use placement new, then you'll need to put the following implementation into a header file, and include it whenever you need it.
 
<sourcesyntaxhighlight lang="C">inline void* __cdecl operator new(size_t size, void* address)
{
return address;
}</sourcesyntaxhighlight>
 
 
==See Also==
=== Articles ===
* [[Visual Studio]]
* [[C++]]
 
=== External Links ===
* [http://msdn.microsoft.com/en-us/library/bb918180.aspx CRT Initialization on MSDN]
 
[[Category:Compilers]]
[[Category:Visual C++]]
[[Category:C++]]
[[Category:Windows]]