Well i find your tutorial really confusing ,, you talked about lot of stuffs and you did not make it easy for C juniors ,
ReplyHi, i have one utility and have to automatically install the one dll to it. for that it need to ask about the utility compatibility like version and it also ask for the utility is pirate version or original version . if it is original version it need to ask for the identity and have to give the full access to it . otherwise some properties of dll has to be hiddenâ¦. then only it has to install on utility. give me some ideas to do it.
ReplyHi, i have one utility and have to automatically install the one dll to it. for that it need to ask about the utility compatibility like version and it also ask for the utility is pirate version or original version . if it is original version it need to ask for the identity and have to give the full access to it . otherwise some properties of dll has to be hiddenâ¦. then only it has to install on utility. pls give me some ideas to do it.
ReplyYou commit an error. I can prove it. Write to me in PM, we will communicate. P.S. Please review our icons for Windows and windows12icons.
ReplyI thought implicit linking requires the header file as well, you only mentioned .dll and.lib in your explanation though. Is the header file required too?
ReplyI'm a control system student. As you know, in every controller chip, the library functions are in DLL/Lib files. When I try to write use a controller, so I need to know how to call theses functions in the dll files. So, your article teaches me how to do that. Thank you so much. Keep doing what you want!
ReplyThis DLL tutorial is very simple and easy to understand. The example given in this is good. Thank you very much
ReplyI am using VS2010. The #define in DLLTutorial.cpp does not register in the DLLTutorial.h file. I have to specify the DLL_EXPORT preprocessor definitions in C/C++ - Preprocessor - Preprocessor Definitions. This seems rather strange to me. If you can think of something I am missing, please let me know! Thank you very much for the tutorial!
Hi, If you don't want to register the "#define DLL_EXPORT" in prepocessor you also, in this case, can moving it before the "#include "DLL_Tutorial.h" " Define the Export in preprocessor depend of the project. In this example the workspace (in case of VisualC++) has 1 project only, the dll, but in biggest project you can have workspace will several project, with some of them exporting library and other importing library, so using a preprocessor named "DLL_EXPORT" can be dangerous if you use the same preprocessor in each module of your workspace. But no misunderstanding, using the prepocessor definition in the example is perfectly fine. I just want to raise this possibility in case of some beginner are reading the example (because it has be made of them). Thanks!
ReplyThis tutorial is quite nice, but there are a few things that need to be updated or added. First of: HINSTANCE hInstLibrary = LoadLibrary("DLL_Tutorial.dll"); should be changed to HINSTANCE hInstLibrary = LoadLibrary(L"DLL_Tutorial.dll"); secondly, about the *.def file You need to create a *.def file, say "AllExports.def" in notepad and then adding it to the project. Put this code in it: LIBRARY dll_tutorial EXPORTS Add @1 Function @2 now you can build the project and get the dll. If you do not do this, then when you try to use _AddFunc = (AddFunc)GetProcAddress(hInstLibrary, "Add"); you will always get a NULL value.
Hi Joe, Your tutorial is really great and very appreciated. Thank you. Concerning the addition of the L to the LoadLibrary, i.e. HINSTANCE hInstLibrary = LoadLibrary(L"DLL_Tutorial.dll"); - I agree with Umair. I just ran your DLL_Src and DLLTest_Src in Visual Studio Express 2012 (Desktop) - and I needed to add the "L" as well. Guessing that it depends on what compiler is being used. Anyway thanks for posting.
ReplyI have problems to load a .dll I downloaded a .dll called nsMCDLibrary.dll and I created a folder in C:/Neuroshare and I saved it here. I add the folder path to my path environment variable. And I checked dependencies with dependency walker Now, I have a C++/Qt program where I do this: char *libname = "nsMCDLibrary.dll"; HINSTANCE h = LoadLibrary((WCHAR*)libname); Then h = 0 and GetLastError = 126 If I do this WCHAR *libname = L"nsMCDLibrary.dll"; HINSTANCE h = LoadLibrary(libname); Then h = 268435456 and GetLastError = 127 I don´t know where is the problem. Could you help me? Or Could you say me anything that I have to check? Thank you, Daniel.
ReplyThanks very much, I learnt the DLL basics using your article.
Reply