.NET Framework Bookmark and Share   
 index > 64-Bit .NET Framework Development > CrtIsValidHeapPointer vs. __DllMainCRTStartup@12 in VS2008 x64
 

CrtIsValidHeapPointer vs. __DllMainCRTStartup@12 in VS2008 x64

Hi,
Using VS2008 C++ mixing managed and unmanaged (static C++ libs) code.
Now, when running my application I get an exception about some code that was not created on the managed heap; basically the exception gets generated when something calls:
CrtIsValidHeapPointer(...)

Ok, in some other forum thread, a solution was posted: "Add __DllMainCRTStartup@12" under linker options "Force Symbols Reference".
This all works fine when the application is compiled for win32, but when compiled for amd64 (x64), then I get a linker error:
-------------------
Linking...
1>LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup@12
-------------------

Any ideas ?
Thanks.
God bless you,

Saul Rodriguez

SaulRdzDavila
In 64-bit compiles, exported functions are not decorated. Use __DllMainCRTStartup (two underscores). Please use this forum only to ask questions about the .NET framework.
Hans Passant.
nobugz
In 64-bit compiles, exported functions are not decorated. Use __DllMainCRTStartup (two underscores). Please use this forum only to ask questions about the .NET framework.
Hans Passant.
nobugz
I still get the following linker error with x64
----
1>------ Build started: Project: xxxx, Configuration: Release x64 ------
1>Linking...
1>LINK : error LNK2001: unresolved external symbol __DllMainCRTStartup
----

Although I am using dynamic c++ libraries (/MD).

Thanks in advance.
  • Edited bywoo and yay Friday, November 21, 2008 1:52 PMMore info.
  •  
woo and yay
Try using "_DllMainCRTStartup" in the Input section of your Linker instead. There's a function with that name that should be in your include libraries. Worked for me...
Xept
In Linker->Input->Force Symbols Reference:_DllMainCRTStartup

...one underscore, and that works for me.

Blessings,

Saul
SaulRdzDavila

You can use google to search for other answers

Custom Search

More Threads

• P/Invoke memory faults when marshaling ByRef AnsiBStr on x64
• C# and Access Connectivity on 64bit machine
• Net 3.5 app significantly slower on x64 than x86
• Windows Service EXE x86 + Assembly (AnyTarget)?
• DllGetVersion declaration ?
• 64-bit SortedDictionary class over 3x slower than 32-bit version?
• Visual Studio 2005 x64 issues.
• using x64 COM Dll in VB.NET
• comctl32.dll --- 64 bit version
• Where do I get development tools for x64