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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:15:33+00:00 2026-05-26T00:15:33+00:00

First i thought entry point in dlls DLLMain but then when i try to

  • 0

First i thought entry point in dlls DLLMain but then when i try to import it in C# i get an error that entrypoint wasn’t found Here is my code:

#include <Windows.h>

int Test(int x,int y)
{
    return x+y;
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
        MessageBox(0,L"Test",L"From unmanaged dll",0);
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
} 

How can i set an entry point for my dll? And if you dont mind can you give me little explanation about entry point?

Like do i have to set import the same dll again and changing the entry point so i can use other functions in same dll? thanks in advance.

  • 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-05-26T00:15:34+00:00Added an answer on May 26, 2026 at 12:15 am

    In your example, it seems you intend Test() to be an entry point however you aren’t exporting it. Even if you begin exporting it, it might not work properly with C++ name “decoration” (mangling). I’d suggest redefining your function as:

    extern "C" __declspec(dllexport) int Test(int x,int y)
    

    The extern "C" component will remove C++ name mangling. The __declspec(dllexport) component exports the symbol.

    See http://zone.ni.com/devzone/cda/tut/p/id/3056 for more detail.

    Edit: You can add as many entry points as you like in this manner. Calling code merely must know the name of the symbol to retrieve (and if you’re creating a static .lib, that takes care of it for you).

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

Sidebar

Related Questions

Okay at first I thought this would be pretty straightforward. But I can't think
here's the main code at first I thought is was the message box but
First off I'm not sure that's the proper title for this question but hopefully
does the following integer arithmetic property hold? (m/n)/l == m/(n*l) At first I thought
Ok first of all, the unicorn avatars are hilarious. Seriously, I thought my account
I very rarely meet any other programmers! My thought when I first saw the
I'm using $lang=$_SERVER['HTTP_ACCEPT_LANGUAGE']; to detect the language of the browser. At first, I thought
My first thoughts are Erlang, or Java, but I wanted to know from others
And I'm not meaning Bits Per Minute, but Business Process Management. At first though
First of all, sorry about the title -- I couldn't figure out one that

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.