Calling C++ DLL ( not MFC) from another C++ DLL ( not MFC)
-
Hi, I have a C++ DLL ( not MFC )which has a static method say class Test { static GetData(); Static GetParams(); bool TestDatat(); }; I am exporting this class and using in another DLL. I built Test.dll,Test.lib. Now i included in another DLL(say Samp.DLL): Test.dll,Test.lib abd Test.h in Samp.h file i inclued "Test.h" and linkedTest.lib and Placed Test.dll in Release/Debug folder. I am calling Test::GetData() in Samp.DLL. But after compiling Samp.DLL giving error like: "error LNK 2001: unresolved external symbol. _declspec(dllimport) public:static bool _stdcall Test::GetDatta(char const *,bool)(_imp_?GetData@Test@SG_NPBD_N@Z)". while building if i change project setttings "_cdecl*" in calling conventions, DLL is building fine,but failing to call a value from Samp.DLL by passing value to Test.DLL. If i what to build my Samp.DLL by "_stdcall" convention how can i build this ? Any help on this.. Thank you.
-
Hi, I have a C++ DLL ( not MFC )which has a static method say class Test { static GetData(); Static GetParams(); bool TestDatat(); }; I am exporting this class and using in another DLL. I built Test.dll,Test.lib. Now i included in another DLL(say Samp.DLL): Test.dll,Test.lib abd Test.h in Samp.h file i inclued "Test.h" and linkedTest.lib and Placed Test.dll in Release/Debug folder. I am calling Test::GetData() in Samp.DLL. But after compiling Samp.DLL giving error like: "error LNK 2001: unresolved external symbol. _declspec(dllimport) public:static bool _stdcall Test::GetDatta(char const *,bool)(_imp_?GetData@Test@SG_NPBD_N@Z)". while building if i change project setttings "_cdecl*" in calling conventions, DLL is building fine,but failing to call a value from Samp.DLL by passing value to Test.DLL. If i what to build my Samp.DLL by "_stdcall" convention how can i build this ? Any help on this.. Thank you.
Have you exported using _declspec(dllexport) and imported using _declspec(dllimport)? Can you show how you are importing and exporting? Jaime
-
Hi, I have a C++ DLL ( not MFC )which has a static method say class Test { static GetData(); Static GetParams(); bool TestDatat(); }; I am exporting this class and using in another DLL. I built Test.dll,Test.lib. Now i included in another DLL(say Samp.DLL): Test.dll,Test.lib abd Test.h in Samp.h file i inclued "Test.h" and linkedTest.lib and Placed Test.dll in Release/Debug folder. I am calling Test::GetData() in Samp.DLL. But after compiling Samp.DLL giving error like: "error LNK 2001: unresolved external symbol. _declspec(dllimport) public:static bool _stdcall Test::GetDatta(char const *,bool)(_imp_?GetData@Test@SG_NPBD_N@Z)". while building if i change project setttings "_cdecl*" in calling conventions, DLL is building fine,but failing to call a value from Samp.DLL by passing value to Test.DLL. If i what to build my Samp.DLL by "_stdcall" convention how can i build this ? Any help on this.. Thank you.
[edit] Regular DLLs don't You shouldn't [/edit] expose objects in a regular DLL (only ActiveX or MFC Extension DLLs) if you want the calling code to be something besides C++. You'll need to export a regular C-style function that serves as a wrapper to the method/property you are trying to invoke. Jeremy Falcon
-
[edit] Regular DLLs don't You shouldn't [/edit] expose objects in a regular DLL (only ActiveX or MFC Extension DLLs) if you want the calling code to be something besides C++. You'll need to export a regular C-style function that serves as a wrapper to the method/property you are trying to invoke. Jeremy Falcon
:confused: He's exporting a regular C++ class. Nothing magical about that, and is certainly possible with DLLs. -- Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr. Welle: Erdball - F104-G Starfighter
-
:confused: He's exporting a regular C++ class. Nothing magical about that, and is certainly possible with DLLs. -- Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr. Welle: Erdball - F104-G Starfighter
Possible, but not practical and in poor practice IMO. Because, if you do that, then your calling language has to be C++. Jeremy Falcon