
please wait
|
|
|
|
#define
d. That way, it __declspec(dllexport)
s the class. In the project that's trying to use the DLL, it shouldn't have DLL_1_EXPORTS #define
d so that way, when it includes A.h, it knows to import the class from the DLL.delete
s it. You'll have to do it that way because you can't call GetProcAddress on all the methods and then bind it to the implementation of a class.#pragma
for your code to use it. Under the project properties->Configuration Properties->Linker->Input->Additional Dependencies, set where the .lib is and your project would recognize it.#pragma
approach, myself.
I think the OP has actual DLLs as targets. |
by using a .def file one will not need the to __declspec(dllexport) or __declspec(dllimport) |
|
|
|
|
|
|
|
|
|
|
|
|
I think that having DLLs on which the whole program will run is better and more professional than having libraries only. Please correct me if I'm wrong. |
My problem till now is in this 3rd dll. It is not able to resolve the class defined in DLL1 and thus giving a lot of errors upon compilation
|
|
|
|
this->prntWnd
is set to null, it is still giving error
|
|
1>Compiling... 1>BsolForm.cpp 1>c:\...\bsolutionsapps\bsolform\bsolform.h(8) : error C2143: syntax error : missing ';' before '*' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(8) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(9) : error C2143: syntax error : missing ';' before '*' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(9) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(14) : error C2143: syntax error : missing ';' before '*' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(14) : error C2071: 'BsolForm::BsolWindow' : illegal storage class 1>c:\...\bsolutionsapps\bsolform\bsolform.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(14) : warning C4183: 'getFormsWnd': missing return type; assumed to be a member function returning 'int' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(15) : error C2143: syntax error : missing ';' before '*' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(15) : error C2071: 'BsolForm::BsolWindow' : illegal storage class 1>c:\...\bsolutionsapps\bsolform\bsolform.h(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\...\bsolutionsapps\bsolform\bsolform.h(15) : warning C4183: 'getFormsPrntWnd': missing return type; assumed to be a member function returning 'int' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(16) : error C2061: syntax error : identifier 'BsolWindow' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(17) : error C2061: syntax error : identifier 'BsolWindow' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(18) : error C2061: syntax error : identifier 'BsolWindow' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(19) : error C2061: syntax error : identifier 'BsolEditBox' 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(5) : error C2039: 'formsWnd' : is not a member of 'BsolForm' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(5) : see declaration of 'BsolForm' 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(5) : error C2653: 'BsolWindow' : is not a class or namespace name 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(5) : error C3861: 'BsolWindow': identifier not found 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(6) : error C2039: 'prntWnd' : is not a member of 'BsolForm' 1>c:\...\bsolutionsapps\bsolform\bsolform.h(5) : see declaration of 'BsolForm' 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(7) : error C2440: '=' : cannot convert from 'BsolLinkList' to 'BsolLinkList *' 1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(8) : error C2065: 'BsolEditBox' : undeclared identifier 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(8) : error C2146: syntax error : missing ';' before identifier 'edtBx_v' 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(8) : error C2065: 'edtBx_v' : undeclared identifier 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(8) : error C2653: 'BsolEditBox' : is not a class or namespace name 1>c:\...\bsolutionsapps\bsolform\bsolform.cpp(8) : error C3861: 'BsolEditBox': identifier not found 1>c:\...\BSolutionsApps\BsolForm\Debug\BuildLog.htm" 1>BsolForm - 28 error(s), 2 warning(s) ========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ========== |
|
|
using namespace BsolControls;
__declspec(dllexport)
. This is incorrect. When you compile DLL3, it will think it will have to dllexport BsolLinkList, BsolEditBox, and BsolWindow. What it needs to do is __declspec(dllimport)
them instead.DLL_1_EXPORTS
|
|
|
|
__declspec(dllexport)
and __declspec(dllimport)
.although i didnt understand the role of __declspec(dllexport) and __declspec(dllimport) |
__declspec(dllexport)
in front of a class or function, this says to the compiler that you want to expose this class or function to the user of this DLL.
|
|
__declspec(dllexport)
tells the compiler that you want to expose these functions. But that's not what the customer wanted! They wanted to use the functions from the DLL. Now Your customer is angry because they're getting linker errors about how intAdd and intMultiply aren't defined anywhere.
|
|
__declspec(dllimport)
does is it tells the compiler that the function is defined in the DLL and not in the current project. Your customer is happy and you get paid.#ifdef
trick I showed you above. Let's say you add MY_DLL_EXPORTS
to the preprocessor input in your project (it's safe to say your customer won't have the same thing defined).
|
|
__declspec(dllexport)
in front of the functions and when your customer compiles the DLL, the preprocessor will place __declspec(dllimport)
in front of the functions. Now, you can create a DLL for your customer, and they will be able to use the DLL (without linker errors) all with only one header file! Mission accomplished.what should the window style be in order to get a main frame window and then create a child window |
|
character).WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_HSCROLL | WS_TABSTOP
#ifdef
was already clear to me. While the role of __declspec(dllexport)
and __declspec(dllimport)
was ambiguous to me. But after your explanation, things are getting clearer.WS_CHILD
but the problem was that I wasn't passing a parent window HWND
in the create function. Now this problem is fixed as well.