how to export global variable in C dll?



Hi,
I've written a DLL using C (not C++) and I'm trying to export its
global variables so that they can be read by client code. I'm having
trouble to find documentation about how to do this. My attempts to
use 'extern' and/or '__declspec' on the global variables result in
linker errors when building my DLL. Will someone please point me to a
reference which address global variables in C dlls?

Thanks!
.



Relevant Pages

  • Re: Queries about DLL Exports
    ... global variables for use it. ... dll with out redefining?Macros are for use at compile-time, so #define them within your project. ... shared memory concept in dll? ... makes header file for Exporting things from dll in other project.Look up __declspec dllexport and dllimport. ...
    (microsoft.public.vc.language)
  • Re: convert an MFC application to MFC DLL
    ... This suggests that there are too many global variables. ... All the header files which contain extern ... Once the variables are in the DLL, they cannot be accessed by the main program. ... The whole notion that there is a "single" main.cpp which contains the declarations of the ...
    (microsoft.public.vc.mfc)
  • Re: Passing reference of the main thread control
    ... Problem is that the code from where I want to call it is a dll which I also ... pass as a reference in the IDE level, ... a common scenario is having an external DLL that needs to invoke some client method. ... your client code will need to include a call to Invokeinside the method used to create the delegate passed to the DLL. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Using TLSAlloc to read data into a DLL
    ... DLL_PROCESS_ATTACH, as you indicate. ... etc. to be able to do this - that global variables are not ...     Igor Tandetnik ...
    (microsoft.public.vc.language)
  • Re: Queries about DLL Exports
    ... global variables for use it. ... global variable from dll? ... shared memory concept in dll? ... makes header file for Exporting things from dll in other project. ...
    (microsoft.public.vc.language)

Loading