_ Crtisvalidheappointer (puserdata) error when the C ++/CLI program is started

Source: Internet
Author: User


A strange mistake !! When C ++/CLIProgramAfter native Lib is referenced for compilation, the following error may occur during program startup:


This is a known bug in ms. cause:

The reason why you get this error is that a winforms application has a managed entry point. the initialization of the native global objects is done by the CRT (C Runtime) startup routine. since in this case there is no CRT startup routine the myboard global object fails to initialize correctly.

IDE is specific the entry of managedapp as "Main". However, using "Main" will bypass a lot of CRT's startup initialization.



Right-click Project ---> properties ---> link ---> advanced

Change the entry point from main "? Maincrtstartupstrarray $ fymhp $ 01ap $ aavstring @ system @ Z"



That shoshould re-enable the CRT startup code which initializes the internal CRT variables. that symbol is really the mangled name for "int _ clrcall maincrtstartupstrarray (CLI: array <class system: String ^> ^ )".



I wasted a night on this problem .............



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.