Hi guys, I have some quick questions on windows dll.
I mainly use ifdefs to handle dllexport and dllimport, my question is about hosting dllexports and dllimports, as well as the extern keyword.
I put dllimports / dllexports in the header files, but do I need to put dllexport and dllimports on the actual definition?
What about typedefs?
Did I put dllimport / dllexport in front? how in
dllexport typedef map<string, int> st_map
Also regarding the extern keyword, I saw that it is used as follows:
extern "C" {
dllexport void func1();
}
I also saw that it is used as follows:
extern dllexport func1();
"", , , , ? , dllexport, dllimport, , ?
, , , typdefs, , , dll.
- , ?
EDIT:
, , , , , linux windows, :
mydll.h
#ifdef WINDOWS
# ifdef PSTRUCT_EXPORT
# define WINLIB __declspec(dllexport)
# else
# define WINLIB __declspec(dllimport)
# endif
#else
# define WINLIB
#endif
WINLIB void funct1();
:
mydll.cpp
#define PSTRUCT_EXPORT
void funct1() <---- do i need to add WINLIB in front of it?
Or is doing it in the header enough?