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

  • Home
  • SEARCH
  • 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 8709477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:22:18+00:00 2026-06-13T04:22:18+00:00

I am trying to use a threading library which has a thread start function

  • 0

I am trying to use a threading library which has a thread start function defined like this:

int vg_thread_create(VGThreadFunction func, 
  void *arg, 
  VGThreadDescriptor *tid,
  void *stack, 
  size_t stack_size,
  long priority,
  int flags );

And VGThreadFunction is the following typedef:

typedef void* (*VGThreadFunction) ( void* )

For the sake of argument I have a function like this:

void doit() {
  cout << "Woohoo printing stuff in new thread\n";
}

The signature of this function is not void* func(void*) – am I forced to use such a function signature?

If I try:

VGThreadFunction testfunc = &doit;

I get

error C2440: ‘initializing’ : cannot convert from ‘void (__cdecl *)(void)’ to ‘VGThreadFunction’

How do I use vg_thread_create?

EDIT

I tried this:

void* doit(void* donothingvar) {
  cout << "printing stuff in new thread\n";
  return donothingvar;
}

then in a function:

VGThreadFunction testfunc = (VGThreadFunction)doit;

int ret = vg_thread_create(testfunc, 0, 0, 0, 0, 0, 0);

I then get an access violation when calling vg_thread_create.

If I step into the function it actually crashes when it calls _beginthreadex

Unhandled exception at 0x0040f5d3 in threadtest.exe: 0xC0000005: Access violation  writing location 0x00000000.

Any ideas?

By stepping into function I worked out I had to pass in a valid pointer – passing zero resulted in a null dereference. sorry, a bit specific.

  • 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-13T04:22:20+00:00Added an answer on June 13, 2026 at 4:22 am

    Yes, the function signature has to match. Just put a dummy parameter on your function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The boost threading library has an abstraction for thread specific (local) storage . I
I am trying to use threading.Timer, I am wondering is this timer is started
I'm getting the following Exception when trying to use SaveFileDialog: System.Threading.ThreadStateException: Current thread must
I'm getting the following Exception when trying to use FolderBrowserDialog: System.Threading.ThreadStateException: Current thread must
I am need paint my image. I'm trying use JQuery in here this link:
I'm trying to use threading to load an image from a url. I have
I am trying to use OpenMP for threading as it is cross platform. However
well,I wrote a little snappet trying to know how to use python threading .
I am trying to use powershell to script some tasks within internet explorer. This
I'm trying to use System.Windows.Forms.HTMLDocument in a console application. First, is this even possible?

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.