🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages Started by Gianstefano Monni Mon, 14 Apr 2003 07:14
static variables of a Class inside a DLL
#17010
Author: Gianstefano Monni
Date: Mon, 14 Apr 2003 07:14
42 lines
2331 bytes
Hi,
    I hope that this is the right newsgroup to post this problem.
I need to use a class that has many static variables. I've tested it as
a standalone class, and it works. Now I'm trying to put it in a DLL. I use
many DLLs in my project group, and all work as I expect to, but I can't use
static variables from outside the DLL. They seem to have random values.
My code looks like this:
//--------------------------------------------------------------------------
---------------------- CODE STARTS
#ifdef __DLL__
                #define DLL_EXP __declspec(dllexport)
#else
                #define DLL_EXP __declspec(dllimport)
#endif

class DLL_EXP CParameters
{
protected:
        CParameters(CParameters&);
        CParametersoperator =(CParameters&);
        CParameters();
        ~CParameters();

static CParameters * parm;

public:
   static void InitDefaults();

   //camera dependent params
   static int VImageMaxX,
              VImageMaxYM
               VGain;
};
//--------------------------------------------------------------------------
---------------------- CODE ENDS
the parm variable is a Singleton. I build it the first time that
InitDefaults is called, i'm __sure__ that all parameters have been
initialized. Inside the DLL the values seem to be right, but when I try to
use them outside the DLL, they have random values.
Does anyone have any idea to suggest?
Thanks in advance,
    Gianstefano Monni
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads