lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


There is nothing particularly strange about it. Static class data is
just like static C data. It lives within a compilation unit, which is
basically a single .CPP file. If you use the correct
__declspec(dllexport) / __declspec(dllimport) declaration on your
class, then you shouldn't have a problem. Perhaps your static data
needs to be initialized? Does your static data have a non-trivial
constructor? If so, then you must realize that these constructors are
run by the DLL loader, which is built into your DLL by the linker. You
must take care not to use such objects until after the DLL loader has
finished running.

On Mon, Apr 21, 2008 at 9:48 AM, Wesley Smith <wesley.hoke@gmail.com> wrote:
> This is somewhat OT (but not in the sense that it's part of a larger
>  lua project).  I don't really use windows that often and am looking
>  for some pointers for tracking down some really nasty dll issues.  How
>  does one deal with static data members in a C++ class that's in a dll?
>   I can't find any info googling.  As best I can tell, my static vars
>  are off in some strange memory zone and thus causing crashes.  Anyone
>  perhaps know something about this, where I can find info, better
>  places to ask?
>
>  thanks for humoring me,
>  best,
>  wes
>