473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Functions exported in C++ and global variables;

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

Jul 23 '05 #1
1 1872
XBSANTOS wrote:
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
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: will taubin | last post by:
i would like my program to have a config.php with passwords and other stuff. i would like to have a functions.php to hold all my functions. i would like the functions.php to include/require...
99
by: David MacQuigg | last post by:
I'm not getting any feedback on the most important benefit in my proposed "Ideas for Python 3" thread - the unification of methods and functions. Perhaps it was buried among too many other less...
76
by: Nick Coghlan | last post by:
GvR has commented that he want to get rid of the lambda keyword for Python 3.0. Getting rid of lambda seems like a worthy goal, but I'd prefer to see it dropped in favour of a different syntax,...
1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
8
by: lawrence | last post by:
I'm learning Javascript. I downloaded a script for study. Please tell me how the variable "loop" can have scope in the first function when it is altered in the second function? It is not defined...
10
by: ankisharma | last post by:
Hi all At many places I have seen that programmers pass global variables to functions in c. I am not able to figure out why they do so. need some clues on this. somewhere i heard that this...
1
by: xbsantos | last post by:
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...
7
by: zeecanvas | last post by:
Hi, First of all: Yes, I know global variables are bad, but I've a huge amount of legacy code, and I've to maintain it _as_is_. I'm maintaining a big program. I moved all (program-wide scope)...
1
by: metiu | last post by:
Hi all, maybe it's an old question, but I couldn't find an answer... let's say I have this kind of directory structure for project foo: /foo/includes/mod1.h (exported by mod1)...
5
by: jonkersbart | last post by:
Dear, I have wrote a script and want to group some functions of the script in a separate modulo so that I can import the module in other scripts and use the same functions there.. The problem...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.