Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9204145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:38:21+00:00 2026-06-17T23:38:21+00:00

I am working on managed C++ or C++/CLI. I am trying to start a

  • 0

I am working on managed C++ or C++/CLI. I am trying to start a CLI thread to execute a function. However when I try to build I get the error “Microsoft (R) C/C++ optimizing compiler has stopped working.” In the output window. “Foo.cpp(8): fatal error C1001: An internal error has occurred in the compiler.”

//the class which holds the function to run 
ref class Foo
{
    void handleEvent();
    void (*func)(void);
};

void Foo::handleEvent()
{
    ThreadStart ^ param = gcnew ThreadStart(func); //line 8
    Thread ^ thread = gcnew Thread(param);
    thread.Start();
}

Is ThreadStart not capable of handling native function pointers? If not, is there is another way to run a regluar C function pointer from C++/CLI?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:38:23+00:00Added an answer on June 17, 2026 at 11:38 pm

    Try substituting line 8 with

    ThreadStart^ param = (ThreadStart^) System::Runtime::InteropServices::Marshal::GetDelegateForFunctionPointer((IntPtr)func, ThreadStart::typeid);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've managed to get my pthreads program sort of working. Basically I am trying
I managed to get the YUI calendar widget working fine. But When it displays
I'm managed to get the validation working for the second step and third step
Finally I managed to get pylucene working on my windows7 machine, Which raised a
I have finally managed to get javan-whenever gem working on my site5 server, and
I'm working with KendoUI MVC in MVC3. I managed to get a dropdown in
Okay, I've managed to get .on working on a different site, but for some
I am working with mixed mode assemblies in C++/CLI. All managed mode assembled pdb's
I managed to get it working on Win32 (inheriting from wx.MiniFrame does the trick),
UPDATE: I managed to get this thing working! Turns out, you NEED to send

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.