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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:16:13+00:00 2026-05-20T06:16:13+00:00

I all, I have a win32 application and several DLLs that must use a

  • 0

I all,
I have a win32 application and several DLLs that must use a global variable. In each dll I put

extern MYTYPE* myvariable = NULL;

and in the main program I have

MYTYPE* myvariable = NULL;
mavariable = new MYTYPE();
....

now, when the DLLs are loaded myvariable is NULL and I cannot use it. How can I share the instance of the main program with all the DLLs?

  • 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-20T06:16:13+00:00Added an answer on May 20, 2026 at 6:16 am

    You should make some changes in your program. If it is possible you can just move myvariable from the EXE to one from DLL. Then you can continue to use import libraries.

    It general you can export functions or data from an EXE, but in the most cases there are less sense to do this. So you can see this very seldom. For example WinWord.exe or Excel.exe do this.

    If really need to export frunction or data from EXE and use it in the DLL you should use dynamical binding with respect of GetProcAddress and GetModuleHandle(NULL). You can do such kind of manual binding inside of DllMain. The address of myvariable of the EXE you can save in the local myvariable of the DLL.

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

Sidebar

Related Questions

I have a Win32 C++ Application using a handful of third-Party DLLs that is
I have an unmanaged Win32 C++ application that uses multiple C++ DLLs. The DLLs
I am maintaining several Perl scripts that all have similar code blocks for different
I've got a DLL that I've created as a C++ Win32 application. To prevent
I have a Unicode Win32 application that uses 3rd party libraries, some of which
I have a 3rd party DLL that I am trying to use in a
We have a Win32 application that hosts the .NET runtime and opens up .NET
I have a delphi (Win32) web application that can run either as a CGI
I have a win32 application, in which I want to use openGL just for
I have simple win32 application (not dialog box), and treeview in this application. All

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.