C ++ DLL Binding UnResolved Externals

I have a rather large project Corethat I'm working with, I try to adapt it to use the DLL Engine that I created, I get a bunch of errors, such as:

unresolved external character "private: static class

When some headers from the kernel are included in the DLL, the class is exported via __declspec (dllexport), but any header with static members produces error redundancy relative to static members.

This is a fairly large project, I can’t exactly delete every static member of the class that I see, is there anything at all like that?

The main example of an imported class:

class __declspec(dllexport) MyClass
{
    public:
        static bool m_someVar;
}

For clarity, I just wanted to say that m_someVar is defined / declared (forgot the term) in the class implementation file

+3
3

Core , dllexport; , DLL, , dllimport. dllexport, , DLL, , ( , ), .

. __declspec ing , Core DLL:

#ifndef I_AM_A_DLL
#define EXPORT __declspec(dllexport)
#define IMPORT __declspec(dllimport)
#else
#define EXPORT __declspec(dllimport)
#define IMPORT __declspec(dllexport)
#endif

EXPORT Core IMPORT DLL:

class EXPORT MyClass
{
    public:
        static bool m_someVar;
}
+5

Dumpbin.exe/exports DLL, :

1    0 0001107D ??4MyClass@@QAEAAV0@ABV0@@Z = @ILT+120(??4MyClass@@QAEAAV0@ABV0@@Z)
2    1 00017000 ?m_someVar@MyClass@@2_NA = ?m_someVar@MyClass@@2_NA (public: static bool MyClass::m_someVar)

, , . undname.exe, :

Undecoration of :- "?m_someVare@MyClass@@0EA"
is :- "private: static unsigned char MyClass::m_someVare"

. . , :

#undef bool

:)

+2

Maybe a stupid question, but you define it somewhere? Your definition will look something like this:

bool MyClass::m_someVar = false;
0
source

Source: https://habr.com/ru/post/1741557/


All Articles