Re: how to export global variable in C dll?
- From: Cyrfer <cyrfer@xxxxxxxxx>
- Date: Wed, 9 Apr 2008 18:03:20 -0700 (PDT)
I've found a fix for my problem, but I'm still looking for
documentation on declaring global variables for C (and C++ now too)
DLLs.
It appears that one should export global variables in C DLLs the same
way as one does in C++ DLLs, prefixing the global declarations with
'__declspec( exp/imp )'.
In my case, I see linking errors when doing it because I had a file
in my C DLL project that ended with the .cpp file extension. Even
though all types were C, the C++ compiler must have been used to
compile my DLL. I don't know why I see a link error when using the
export prefix, but changing my .cpp to have the .c file extension
fixed the problem.
Happy coding.
On Apr 9, 5:12 pm, Cyrfer <cyr...@xxxxxxxxx> wrote:
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!
.
- Follow-Ups:
- Re: how to export global variable in C dll?
- From: Alex Blekhman
- Re: how to export global variable in C dll?
- References:
- how to export global variable in C dll?
- From: Cyrfer
- how to export global variable in C dll?
- Prev by Date: how to export global variable in C dll?
- Next by Date: Re: global and static object
- Previous by thread: how to export global variable in C dll?
- Next by thread: Re: how to export global variable in C dll?
- Index(es):
Relevant Pages
|
Loading