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 8262587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:48:09+00:00 2026-06-08T03:48:09+00:00

I need to gain performance by using 2 hardware CPUs on MS Windows. I

  • 0

I need to gain performance by using 2 hardware CPUs on MS Windows. I write the following code:

#include "windows.h"

int main1(int argc, CHAR* argv[])
{
    // ...
}

int main2(int argc, CHAR* argv[])
{
    // ...
}

to write two main functions – one for every CPU. The compiler tells me:

D:/MinGW/x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-crt0_c.o):crt0_c.c:(.text+0x3d): undefined reference to `WinMain'
collect2.exe: error: ld returned 1 exit status

What am i doing wrong? How can i write two mains to make them run on two different CPUs? _tmain1, _tmain2 does not help either.

  • 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-08T03:48:12+00:00Added an answer on June 8, 2026 at 3:48 am

    You create one main, and start another thread for which you set the processor affinity.

    pseudocode:

    int main1(){...}
    int main2(){...}
    
    int main()
    {
      main2_thread = StartThreed( main2 );
      SetProcessorAffinity( this_thread, 0 );
      SetProcessorAffinity( main2_thread, 1 );
      main1();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are many tools for code quality. But sometimes need gain performance also if
I need to perform a block of code like the following: x = some_number;
Is there any performance gain in calling C code from Objective-C? I've read somewhere
Given the following piece of code: using(var data = new SomeDataContext(ConnectionString)) { data.ObjectTrackingEnabled =
I need to gain access to the list of most recently used programs and
Goal: Gain datatype date with year and month Problem: Need to help to convert
Need some regular expressions help. So far I have my code working to allow
If you need to access a WPF control from the code behind, you need
I need to write a program which will write many characters in a output
Nothing is currently broken. :) I'm just looking to gain some performance. I have

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.