Export class from c ++ dll?

How to open a class from dll?

An application importing a dll must be able to create class objects, and it must also be able to call member functions of the class.

Is it compatible with how to expose type C functions with __declspec(dllexport)?

And also when I built the dll (which contains only the class definition in the header file and its definition of member functions in the cpp file), the corresponding lib file is not created.

+3
source share
5 answers

Is it compatible with how to expose type C functions with _declspec(dllexport)?

Yes. And __declspec can be applied to the class.

the corresponding lib file is not created

IIRC is the default, but you can override the default linker options.

+1

. , LoadLibrary()/GetProcAddress().

+2

_declspec (dllexport) lib. , (.. ), ( ). _declspec (dllexport), , dll DLL. OS DLL, exe, .

"factory" . Symbian OS, , DLL. :

  • (.. ) (.. cpp) DLL. .

  • "factory" dll, . _declspec (dllexport).

  • lib .

  • lib.

  • factory (.. ), .

5 Symbian OS. . , , Windows.

+2

Googling for the dllexport class led to this page from MSDN as the first result.

The page seems to show that only __declspec(dllexport)is all you need to do.

0
source

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


All Articles