Hi All,
I'm writing a Windows DLL which contain some utility classes.
One of my classes is Singleton, therefore contain some static members.
I'm using VC6 and linking to the DLL statically.
My question is where is the correct (and best way) to initialize
theses variables? If I initialize them in the class CPP (in the DLL)
then I get linkage error when I try to link my project with the LIB,
and I don't want to make the user initialize those variables.
---- The DLL mydll.dll :
classA.h:
class DLL_EXPORT A{
static int x;
}
classA.cpp
I would like to write:
int A::x = 0;
----
Thanks,
Avi 14 10609
"Attila Feher" <at**********@lmf.ericsson.se> wrote in message
news:bk**********@newstree.wise.edt.ericsson.se... Avi Uziel wrote: Hi All,
I'm writing a Windows DLL which contain some utility classes. One of my classes is Singleton, therefore contain some static members. I'm using VC6 and linking to the DLL statically. [SNIP]
Your question is Windows (DLL) specific.
His actual question wasn't.
My question is where is the correct (and best way) to initialize theses variables? classA.cpp I would like to write: int A::x = 0;
That is the correct way. If that doesn't work, he has some other problem.
jeffc wrote: "Attila Feher" <at**********@lmf.ericsson.se> wrote in message news:bk**********@newstree.wise.edt.ericsson.se... Avi Uziel wrote: Hi All,
I'm writing a Windows DLL which contain some utility classes. One of my classes is Singleton, therefore contain some static members. I'm using VC6 and linking to the DLL statically. [SNIP]
Your question is Windows (DLL) specific.
His actual question wasn't.
It was. Read the post. My question is where is the correct (and best way) to initialize theses variables? classA.cpp I would like to write: int A::x = 0;
That is the correct way. If that doesn't work, he has some other problem.
The OP wrote:
8<===
If I initialize them in the class CPP (in the DLL)
then I get linkage error when I try to link my project with the LIB,
and I don't want to make the user initialize those variables.
===>8
He has a problem. And it very much seems to be DLL related.
--
WW aka Attila
"WW" <wo***@freemail.hu> wrote in message
news:bk**********@phys-news1.kolumbus.fi... jeffc wrote: "Attila Feher" <at**********@lmf.ericsson.se> wrote in message news:bk**********@newstree.wise.edt.ericsson.se... Avi Uziel wrote: Hi All,
I'm writing a Windows DLL which contain some utility classes. One of my classes is Singleton, therefore contain some static members. I'm using VC6 and linking to the DLL statically. [SNIP]
Your question is Windows (DLL) specific.
His actual question wasn't.
It was. Read the post.
The only question in his post was "My question is where is the correct (and
best way) to initialize theses variables?"
jeffc wrote: "WW" <wo***@freemail.hu> wrote in message news:bk**********@phys-news1.kolumbus.fi... jeffc wrote: "Attila Feher" <at**********@lmf.ericsson.se> wrote in message news:bk**********@newstree.wise.edt.ericsson.se... Avi Uziel wrote: > Hi All, > > I'm writing a Windows DLL which contain some utility classes. > One of my classes is Singleton, therefore contain some static > members. I'm using VC6 and linking to the DLL statically. [SNIP]
Your question is Windows (DLL) specific.
His actual question wasn't.
It was. Read the post.
The only question in his post was "My question is where is the correct (and best way) to initialize theses variables?"
If I initialize them in the class CPP (in the DLL)
then I get linkage error when I try to link my project with the LIB,
and I don't want to make the user initialize those variables.
---- The DLL mydll.dll :
classA.h:
class DLL_EXPORT A{
static int x;
}
classA.cpp
I would like to write:
int A::x = 0;
--
WW aka Attila
"WW" <wo***@freemail.hu> wrote in message
news:bk**********@phys-news1.kolumbus.fi... If I initialize them in the class CPP (in the DLL) then I get linkage error when I try to link my project with the LIB, and I don't want to make the user initialize those variables.
This is off topic. Please don't post off topic messages. Take this to a
Windows newsgroup.
jeffc wrote: "WW" <wo***@freemail.hu> wrote in message news:bk**********@phys-news1.kolumbus.fi... If I initialize them in the class CPP (in the DLL) then I get linkage error when I try to link my project with the LIB, and I don't want to make the user initialize those variables.
This is off topic. Please don't post off topic messages. Take this to a Windows newsgroup.
This is what the OP posted, and you have refused to read. Stop trolling.
--
WW aka Attila
"WW" <wo***@freemail.hu> wrote in message
news:bk**********@phys-news1.kolumbus.fi... jeffc wrote: This is off topic. Please don't post off topic messages. Take this to a Windows newsgroup.
This is what the OP posted, and you have refused to read. Stop trolling.
Here's what the OP posted: "My question is where is the correct (and best
way) to initialize theses variables?" Everything else was irrelevant
detail. Stop being pedantic.
jeffc wrote: "WW" <wo***@freemail.hu> wrote in message news:bk**********@phys-news1.kolumbus.fi... jeffc wrote: This is off topic. Please don't post off topic messages. Take this to a Windows newsgroup.
This is what the OP posted, and you have refused to read. Stop trolling.
Here's what the OP posted: "My question is where is the correct (and best way) to initialize theses variables?" Everything else was irrelevant detail. Stop being pedantic.
And he continued: because when I try the correct way in my DLLs it does not
work.
Stop trolling.
--
WW aka Attila
"WW" <wo***@freemail.hu> wrote in message
news:bk**********@phys-news1.kolumbus.fi... And he continued: because when I try the correct way in my DLLs it does
not work.
You thought he was off topic because you thought something about his DLL was
part of the problem. It wasn't. It had nothing to do with it. His
question was 100% on topic. The DLL was a red herring that you fell for.
If you'd stop worrying so much about your image and the party line, we'd all
be better off.
jeffc wrote: "WW" <wo***@freemail.hu> wrote in message news:bk**********@phys-news1.kolumbus.fi... And he continued: because when I try the correct way in my DLLs it does not work.
You thought he was off topic because you thought something about his DLL was part of the problem. It wasn't. It had nothing to do with it. His question was 100% on topic. The DLL was a red herring that you fell for. If you'd stop worrying so much about your image and the party line, we'd all be better off.
Stop trolling!
--
WW aka Attila
"jeffc" <no****@nowhere.com> wrote in message news:<3f********@news1.prserv.net>... "Attila Feher" <at**********@lmf.ericsson.se> wrote in message news:bk**********@newstree.wise.edt.ericsson.se...
[snip] His actual question wasn't. That is the correct way. If that doesn't work, he has some other problem.
His problem is with some DLL mechanism, once he has posted the right
way of initializing the static variable and reports that he is
recieving a linkage error. So it's OT in this newsgroup.
Regards,
Marcelo Pinto
"Marcelo Pinto" <mp****@tecnolink.com.br> wrote in message
news:e3**************************@posting.google.c om... "jeffc" <no****@nowhere.com> wrote in message
news:<3f********@news1.prserv.net>... "Attila Feher" <at**********@lmf.ericsson.se> wrote in message news:bk**********@newstree.wise.edt.ericsson.se... [snip] His actual question wasn't. That is the correct way. If that doesn't work, he has some other
problem. His problem is with some DLL mechanism, once he has posted the right way of initializing the static variable and reports that he is recieving a linkage error. So it's OT in this newsgroup.
He obviously wanted to know what the right way of initializing the static
variable was. Did you read the post?
jeffc wrote:
[SNIP] His actual question wasn't. That is the correct way. If that doesn't work, he has some other problem.
His problem is with some DLL mechanism, once he has posted the right way of initializing the static variable and reports that he is recieving a linkage error. So it's OT in this newsgroup.
He obviously wanted to know what the right way of initializing the static variable was. Did you read the post?
Stop trolling!
--
WW aka Attila This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steven T. Hatton |
last post by:
Is there a way to initialize an member array of user defined objects that is
declared static const?
For example:
const vec3f I(1,0,0);
const vec3f j(0,1,0);
class corner_functor
{
|
by: Neno |
last post by:
Hi,
I have a linkage error that has something to do with the use of a static
member array and I can't understand how to solve the problem. Can someone
help me please?
In detail:
A class Month...
|
by: utab |
last post by:
Dear all, I am confused at some point on the initialization of static
map member of a class. The class I have designed id something like
this.
class Class_name{
public:
private:
|
by: Calle Pettersson |
last post by:
Coming from writing mostly in Java, I have trouble understanding how to
declare a member without initializing it, and do that later... In Java,
I would write something like
public static void...
|
by: Madhav |
last post by:
hi all,
I was trying the following code on the MS .net compiler:
class Item {
static int count;
public:
//static void init() { }
Item()
|
by: John |
last post by:
Hello,
is there any compiler option for g++ for initializing static members of the
class.
Due to some unknown reason, static member in one of our c++ application is
not getting initialized...
|
by: Grey Alien |
last post by:
class A
{
public:
A(const B& ref);
private:
static B& b ;
};
How may b be initialized ?
|
by: Christopher |
last post by:
Code compiles, but the string evaluates to NULL in debugger. Using gcc
3.1.1.
Did I not initialize the string properly or is this a compiler bug?
// some.h
#include <string>
namespace ns
{
|
by: Ramesh |
last post by:
Hi,
I am trying to create an array of pointers to member functions inside
my class. When I created a global array of type pfn & initialized with
member functions and copy it back to the member...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |