Functions exported in C++ and global variables;

X

XBSANTOS

Functions exported in C++ and global variables;

Hello,

I'm working with a DLL project in VISUAL C++ that exports one function
with the sentence
__declspec(dllexport). The problem is that this function returns the
value of a dll global
variable, but in fact the application that imports this functions from
the dll only see the
initial value of the global variable of the dll, but it doesn't remark
changes of value in this global
variable.

// This is an example of an exported function.
IMPORTINGDLL_API int fnProvadll(void)
{
return xavi;
}

//and the global variable in the DLL is defined like this:

int xavi=0;

What could be the problem? Please some advice from you will be useful!
Thanks all people!

Sincerely,

javitobcn
 
V

Victor Bazarov

XBSANTOS said:
I'm working with a DLL project in VISUAL C++ that exports one function
with the sentence
__declspec(dllexport). The problem is that this function returns the
value of a dll global
variable, but in fact the application that imports this functions from
the dll only see the
initial value of the global variable of the dll, but it doesn't remark
changes of value in this global
variable.

// This is an example of an exported function.
IMPORTINGDLL_API int fnProvadll(void)
{
return xavi;
}

//and the global variable in the DLL is defined like this:

int xavi=0;

What could be the problem? Please some advice from you will be useful!

(a) DLLs are not part of the language, and as such are off-topic. Please
consider asking in a newsgroup where they are topical, like one of the
Microsoft's 'microsoft.public.vc.*' forums.

(b) Whatever code you posted doesn't show any _use_ of the function, nor
does it show how the variable is _changed_ and accessed after that.
You should consider including more information (code) in your post to
'microsoft.public.vc.*'.

Good luck!

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top