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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:00:07+00:00 2026-05-27T04:00:07+00:00

When we have an exe or dll and a static library attached to it,

  • 0

When we have an exe or dll and a static library attached to it, we are able to use extern keyword to access static library’s variables and/or functions from the exe or dll. To make things simpler, let’s assume ve have an exe and a lib attached to it.

What I am trying to do is to call a function of exe from lib.

Executable Code

void doSomething() {
    // do something here
}

Static Linked Library Code

void onSomeEvent() {
    doSomething(); // call doSomething() here
}

Vice versa is easy but I wonder if this can be done in a way like extern keyword. Or what is the best method?

What comes to my mind is to pass a function pointer (like void*) to one of the functions / methods in the lib (probably to a class constructor). I think this should work but I don’t want to touch library’s code too much since library is not mine and can be replaced with newer versions. I can add/remove a few lines of code to it but I want to prevent from changing function interfaces.

What is the better way?

  • 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-27T04:00:08+00:00Added an answer on May 27, 2026 at 4:00 am

    Of course, you merely have to declare the function in the library.

    void onSomeEvent() {
        void doSomething(); // declares the function
        doSomething(); // call doSomething() here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a method registered like this: [DllImport(MyApi.dll, CharSet = CharSet.Ansi)] private static extern
I have a static library that may get linked into either a .exe or
Assume I have a class library project name Utilities.dll as follows: public static class
I have a .exe and many plug-in .dll modules that the .exe loads. (I
I have 4 assemblies: Tester.exe ToyInterface.dll ToyFactory.dll --> reference (ToyInterface.dll) Toy.dll --> reference (ToyInterface.dll)
I have an EXE file using a DLL file which is using another DLL
Say I have some C++ project which builds an exe or dll file. The
I have some .net dll's and Exe's. I need to pass MSIL files to
I have a C# WCF service DLL that gets hosted by WcfSvcHost.exe when I
I'm using Visual Studio 2008. I have a DLL and a test program EXE.

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.