Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RE: Exporting global data from a DLL to an EXE

0 views
Skip to first unread message

Gopalakrishnan

unread,
Feb 21, 2005, 7:51:03 AM2/21/05
to
Micheles,

I don't how did you link the application with the dll. Please make sure that
you have given the library file link in the C++ setting tab.

When you compile your dll workspace, it will give you a dll, export file and
a library file. Make sure whether those files exists are not. And go to
Project Settings --> select Link Tab, in the Object/Library module give the
name of the library file. Please make sure that the file exists in the
specified path. If it not exists copy the lib and dll files to your
application folder and compile it and run it.

I hope this will resolve your problem. If you don't want to use the lib file
with the application, then you cannot access the global variable declared in
the dlls.

Micheles

unread,
Feb 21, 2005, 6:09:26 AM2/21/05
to
Hi,
I have a "Win32 Application" and I must use some global data defined(and
initialized) in a DLL linked to the Application.
As suggested by MSDN,I have exported this global data from the DLL in this
way:
- In the DLL, I have used the keyword DLLEXPORT
- In the EXE I have used the keyword DLLIMPORT
But when I run the EXE the application crashes!
The problem is that, in the EXE, the imported global data are all equal to
zero and the application doesn't see the initializationsdone in the DLL!
Does someone know where is the problem?
Thanks to All.
M


Joseph M. Newcomer

unread,
Feb 21, 2005, 12:06:06 PM2/21/05
to
As usual, like everyone else you use the obscure and meaningless word "crash" without
saying anything about what you mean by the word. The word "crash" is the most useless
possible way to explain a problem. There is no such thing as "a crash". What you saw was a
very specific piece of behavior which caused your program to terminate. TELL US WHAT THAT
WAS! Without knowing what this behavior is, it is impossible to guess what you mean, what
actually happened, or what might be done about it.

Avoid making variables in a DLL visible. If you need to set them, have functions that set
them. If you need to see them, write functions to retrieve the values.

What addresses are reported for these variables?

But largely just get rid of the exports of the variable names.
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

0 new messages