xPert_Umer
asked on
how to import ddl in simple c code?
hello
i have created a dll using c code not C ++ ?
now i want to write another code in c which would import that dll ?
can you please help me out?
i have created a dll using c code not C ++ ?
now i want to write another code in c which would import that dll ?
can you please help me out?
ASKER
is loadlibrary is c function or c++?
It is a Windows API function which can be used in both C and C++.
http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms684175(VS.85).aspx
And here's some example code that goes with that :
http://msdn.microsoft.com/en-us/library/ms686944(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms686944(VS.85).aspx
And the example DLL that goes with it :
http://msdn.microsoft.com/en-us/library/ms682507(VS.85).aspx
http://msdn.microsoft.com/en-us/library/ms682507(VS.85).aspx
ASKER
but why all code including windows.h :( ??? if it is simple c code?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
can you please give me a smple code? the code you sent me they dont have example of loadlibrary?
>> the code you sent me they dont have example of loadlibrary?
Yes, it does, right here :
http://msdn.microsoft.com/en-us/library/ms686944(VS.85).aspx
Note the first two lines of the code :
// A simple program that uses LoadLibrary and
// GetProcAddress to access myPuts from Myputs.dll.
May I ask why you gave a B grade ? That usually means that something was missing in the answer and/or that something is still unclear. If that's the case, you don't have to close the question yet, and can ask for clarification wherever needed. Us experts prefer getting the opportunity to earn an A grade ;)
Yes, it does, right here :
http://msdn.microsoft.com/en-us/library/ms686944(VS.85).aspx
Note the first two lines of the code :
// A simple program that uses LoadLibrary and
// GetProcAddress to access myPuts from Myputs.dll.
May I ask why you gave a B grade ? That usually means that something was missing in the answer and/or that something is still unclear. If that's the case, you don't have to close the question yet, and can ask for clarification wherever needed. Us experts prefer getting the opportunity to earn an A grade ;)
Btw, as I said earlier, there is a simpler alternative, namely simply including the DLL header file, and linking to the DLL lib file. That's it ... nothing more - no LoadLibrary is needed in that case.
ASKER
sorry infinity08.. i didnt get idea of A,B,C :( properly.. hope u wudnt mind:) next tym ll give A ++;)
The grade represents the quality of the answer. The help items relevant to grades are :
"What's the right grade to give?" : https://www.experts-exchange.com/help.jsp#hi97
"How can I change a grade ?" : https://www.experts-exchange.com/help.jsp#hi340
"Grade quickly and fairly" : https://www.experts-exchange.com/help.jsp#hi367
Just fyi ;)
It is meant as a feedback to the experts.
>> sorry infinity08..
No problem :) As long as your question has been answered to your satisfaction, I'm happy :)
"What's the right grade to give?" : https://www.experts-exchange.com/help.jsp#hi97
"How can I change a grade ?" : https://www.experts-exchange.com/help.jsp#hi340
"Grade quickly and fairly" : https://www.experts-exchange.com/help.jsp#hi367
Just fyi ;)
It is meant as a feedback to the experts.
>> sorry infinity08..
No problem :) As long as your question has been answered to your satisfaction, I'm happy :)
You can load a DLL explicitly too using LoadLibrary if you want.