Jell Posted March 26, 2004 Posted March 26, 2004 In my web service i am loading a native c++ DLL at Load time. This Dll exports a method which i need to use in my web service. For this i have done following settings: I have copied the Lib file and the DLL into my project folder. I have specified lib file name in Project->Configuration Properties->Linker->Input->Additional Dependencies and specified DLL name in Project->Configuration Properties->Linker->Input->Delay Loaded Dlls In my web service's ".cpp" file i have added "# include" for the native Dll's header file and also a _declspec(dllimport) for the exported function as follows: #include "CppClassExport.h" __declspec(dllimport) int fnCppClassExport(void); still i find that the DLL is not loading into my web service application when i am running the web service...hence the method is not getting called.. ( i chked using Debug->Windows->module) any idea if i have missed anything else required for Load time DLL loading..??? Quote
Administrators PlausiblyDamp Posted March 26, 2004 Administrators Posted March 26, 2004 C++ is not my strong point but shouldn't the Dll's header file include the relevant declarations to use it rather than you having to also declare the function prototype. Also have you called the __HrLoadAllImportsForDll function to actually load the DLL? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Jell Posted March 29, 2004 Author Posted March 29, 2004 problem loading DLL Also have you called the __HrLoadAllImportsForDll function to actually load the DLL? I havent used HrLoadAllImportsForDLL ...i am trying to use it now but my code is not compiling...it is not recognizing "__HrLoadAllImportsForDll" , so its giving an error "__HrLoadAllImportsForDll': identifier not found, even with argument-dependent lookup" i tried using #include delayimp.h also... also, in an example in MSDN i saw that for loading they havent used any primitives(__HrLoadAllImportsForDll)...they have simple specified the dll to be delay-imported and specified the method name to be called in the code like any other normal method call... the code is pasted below from msdn:: ============================================ #include <windows.h> // uncomment these lines to remove .libs from command line // #pragma comment(lib, "delayimp") // #pragma comment(lib, "user32") int main() { // user32.dll will load at this point MessageBox(NULL, "Hello", "Hello", MB_OK); } Build the DEBUG version of the project. Step through the code using the debugger and you will notice that user32.dll is loaded only when you make the call to MessageBox. ===================================== ur suggestion sounded a way out initially....but i am all the more confused... i just want to load the library to my project...and i am unable to do that...thats my problem... Quote
Jell Posted March 29, 2004 Author Posted March 29, 2004 i just want to load the library to my project...and i am unable to do that...thats my problem... I wud explain my problem in more details.. In vc++6 for loading a DLL at Load time, we used to follow the steps i had enlisted in my first query. I tried using the same steps with vc++.net web service...they dont seem to function.. so i think there must be some more things to consider while trying to load libraries in vc++.net at load time...of which i am totally ignorant.. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.