|
Hi,
I have a DLL which has a class containing static members. In the
implementation file of the class I have done proper initialization of
the static data. These static data are public thus I want to modify
these public static data from another application using this DLL.
Somehow the static initialization is not happening if it is done in the
implementation file and while accessing the storage for static data my
VC7 compiler complains that I am trying to write to an illegal memory.
But if I do the static initialization in the header file itself then I
get no run time error. As far as I know static data initialization
should not be done in header file. So really my question is why is this
happening in the first place and what I need to do to fix it?
DLL CODE:
///////////////////////////////Header
file//////////////////////////////////////////
typedef void (*fptr)(void);
class DllMethods
{
public:
__declspec(dllexport) static int data;
__declspec(dllexport) static fptr function;
};
/////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////Implementation
file//////////////////////////////
#include "DllMethods.h"
//IF THIS INITIALIZATION IS DONE IN THE HEADER FILE FOR THE DLL
//THEN I GET NO ERROR WHEN DEBUGGING WITH VC7 COMPILER
fptr DllMethods::function = 0;
int DllMethods::data = 46;
///////////////////////////////////////////////////////////////////////////////////////
APPLICATION CODE:
#include "DllMethods.h"
#include <iostream>
using namespace std;
static void anotherFunction(void)
{
cout << "Inside anotherFunction" << endl;
}
int main(int argc, char ** argv)
{
//I GET RUNTIME ERROR WHEN THE FOLLOWING LINE
//EXECUTES AND WHEN THE STATIC INITIALIZATION IS
//DONE IN THE IMPLEMENTATION FILE
//BUT IF THE INITIALIZATION IS DONE IN THE HEADER ITSELF
//THEN I GET NO ERROR
//ASSIGN THE FUNCTION PTR OF THE DLL TO THE FUNCTION
//IN THE APPLICAITON
DllMethods::function = anotherFunction;
DllMethods::function();
return 0;
}
Thanks,
Divick
|
|
|
|
|
The current MSDN documentation suggests that CFile::Remove [^]can delete a file where the file spec indicates a network path. However my very old local MSDN library is pretty specific that the file spec can not reference a network file. I'm still using VC++ version 6 and my testing confirms that I can't get the code delete a network file. The exception I catch has the following error message, "A sharing violation occurred while accessing an unnamed file.". This likely means that I need to look into upgrading from version 6 in order to get a more up to date MFC, but I'm wondering if there isn't some other alternative I could try.
Chris Meech
I am Canadian. [heard in a local bar]
When I want privacy, I'll close the bathroom door. [Stan Shannon]
BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
Of course, it would have helped if during my tests, I'd made sure I'd closed the file before trying to delete it. sheesh.
I now return you to normal questions again.
Chris Meech
I am Canadian. [heard in a local bar]
When I want privacy, I'll close the bathroom door. [Stan Shannon]
BAD DAY FOR: Friendly competition, as Ford Motor Co. declared the employee parking lot at its truck plant in Dearborn, Mich., off limits to vehicles built by rival companies. Workers have to drive a Ford to work, or park across the street. [CNNMoney.com]
Nice sig! [Tim Deveaux on Matt Newman's sig with a quote from me]
|
|
|
|
|
There are a lot going on since Apple decided to put an intel processor and I'm a little confused..
Here are some questions! :
1. I know that on an intel based mac, Windows XP and Vista can be installed. Can the inverse be possible? If I get a macintosh cd will it run on my pentium? (I guess not..)
2. Windows can run on a mac. A windows program runs on intel based macintosh without loading windows or some simulation?
3. If [2] is true, can I load the M.V.Studio and all the mfc classes to code on a mac? Will the program run on both Windows and Mac?
3. If [2] is false, how compatible are the two O.S.?
(Questions are only for intel based macs)
|
|
|
|
|
|
2. no, not now, maybe a new rosetta ( rosetta @ Apple [^] ) emulator could do that eventually; that technology now translate the PPC instruction set to Intel instruction set.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Vertical_Horizon wrote: I know that on an intel based mac, Windows XP and Vista can be installed.
How do you know that?
There are some people working hard to make that possible, but this is against Apples will and so far only a technical play of some sort.
If you do not know the answer to your questions, this is certainly nothing you would gain any benefit from.
Sorry!
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Take a look here:
http://onmac.net/
|
|
|
|
|
Oh?!?
They've already awarded the money!
I did not know that
Here[^]
is a download with a installation manual.
Thats certainly not for the faint of heart!
You need to burn a special XP-CD, will loose yu MAC-OS installation and Hardware-support is less than optimal.
So, with the level of knowledge I deduced from your initial questions, you can view thsi as nonexistant.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
does anybody know how to create chevron button (something similar to the notification area button in XP) in win32
Thanks
__________________________________________________
Achievement is not a destiny but a endless journey
-- modified at 9:15 Friday 17th March, 2006
|
|
|
|
|
|
something like that.. But i need exact look as the notification button (which has ">" + round background)
Achievement is not a destiny but a endless journey
|
|
|
|
|
sorry, i really don't see what button you're talking about when saying "notification button".
|
|
|
|
|
have u seen the a button in between notification area and the task bar buttin.. which hides or shows (un)used icons on clicking.. i need a button which exactly resembles that one
Achievement is not a destiny but a endless journey
|
|
|
|
|
this area is not called "notification area" but "system tray"...
well, to answer your question, i don't know myself, but at least, i understood you then...
|
|
|
|
|
i am really sorry on that.. but Microsoft refers that to notification area instead of system try..thats why i said so.. any way..
Atleast do u know how to get a window proc of "Already" subclassed window
Achievement is not a destiny but a endless journey
|
|
|
|
|
v2.0 wrote: this area is not called "notification area" but "system tray"
Microsoft disagrees with you. In fact, Raymond Chen (a Microsoft employee) specifically says that "system tray" is wrong.
Anyway, I've heard both.
|
|
|
|
|
BlueCrack wrote: does anybody know how to create chevron button (something similar to the notification area button in XP) in win32
Use SetWindowRgn(...) .
Nibu thomas
Software Developer
|
|
|
|
|
Thanks Thomas on that. But i have been already using that for a while.. what i need is the visualization similar to the chevron button near system tray..
I dont want to use owner drawn owner drawn button or some GDI stuff. i want to make it simpler
Thanks
Ranga
_______________________________________
Achievement is not a destiny but a endless journey
|
|
|
|
|
Hi, I´m having some trouble rebuilding a sample application for WINNT ( I know... but old hardware card drivers only run there )
First part...
If I use the makefile provided it builds OK but when run in winnt I get "not valid win32 executable" message, (on winxp/2k3 It seems to run ok but of course fails when no drivers are found) we don't have vc6 atm... I tried on 2003 & 2005
2nd part...
If I create a new solution include provided files ( .h & .lib ) the linker fails with...
...
zzz.obj : error LNK2019: unresolved external symbol _strcmp referenced in function
...
zzz.obj : error LNK2019: unresolved external symbol __imp__printf referenced in function _
zzz.obj : error LNK2019: unresolved external symbol __imp__atoi referenced in function _getargs
strings.h / stdlib.h are included in the source... I may be missing some project option I can't find... tried with vc 2003/2005
any tips/suggestions on anything ?
thanks in advance
Pablo75
|
|
|
|
|
It seems you have changed something wrongly in linker options...
Was it working properly with nmake options??
Also check whether "Ignore Default Libraries" option is set "Yes".. If so make it "No"
|
|
|
|
|
I created a new blank solution and can compile and link fine,
with nmake it compiled ok too, but when copying the exe to the winnt pc it fails to load with the "not valid win32 executable" msgbox.
I can't log on terminal server now.. will have to try again later
Pablo75
|
|
|
|
|
could you please give me just the header lines of all the .h & .c* files. It might help me in diagnosis
Achievement is not a destiny but a endless journey
|
|
|
|
|
Does any body know how to get windproc of already subclassed window. bcoz GetWindowLong fails in getting wndproc of subclass window
Thanks
Aceivement is not a destiny but a endless journey
-- modified at 9:01 Friday 17th March, 2006
|
|
|
|
|
Hi all!
I want to get the function name and its signature from any type of DLL(whether it is a COm dll or simple C++ DLL). If the DLL doesn't have any exported function, so how could i get the name and signature of those functions. Is there any tool exists then plz tell, i tried Dependencywalker.exe, but it shows only exported fns.
if anyone can send me any sode then i will be highly obliged.
Regards,
Zia
-- modified at 8:59 Friday 17th March, 2006
|
|
|
|