| | |
DLL and Application
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
Hi,
when i ->include linking as
errors
Circular Untitled2 <- Untitled2.o dependency dropped.
Circular Untitled2 <- Untitled2.o dependency dropped.
When i turn off linking i get 3 more files ,
.dll, .lib, .a
And when i use my WIN API file who is some were above.Get no errors.BUT i did not see message box ,and it was ON included linking.
when i ->include linking as
errors
Circular Untitled2 <- Untitled2.o dependency dropped.
Circular Untitled2 <- Untitled2.o dependency dropped.
When i turn off linking i get 3 more files ,
.dll, .lib, .a
And when i use my WIN API file who is some were above.Get no errors.BUT i did not see message box ,and it was ON included linking.
Last edited by kv79; Dec 21st, 2007 at 3:25 pm. Reason: And "Makefile "
•
•
•
•
Hi,
when i ->include linking as
errors
Circular Untitled2 <- Untitled2.o dependency dropped.
Circular Untitled2 <- Untitled2.o dependency dropped.
When i turn off linking i get 3 more files ,
.dll, .lib, .a
And when i use my WIN API file who is some were above.Get no errors.BUT i did not see message box ,and it was ON included linking.
#pragma comment(lib, "myfile.lib") in your cpp. It will autometicallty link the lib. After that you need not call the LoadLibrary. Just declare the prototype of function and call the function. I know I am. Therefore I am.
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
Hi,
Had no errors and i have not seen message box
C++ Syntax (Toggle Plain Text)
#include <windows.h> #pragma comment(lib, "myfile.lib") typedef void (*function1_ptr) (); function1_ptr function1=NULL;//Now create pointer and set its default value to NULL int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { HMODULE myDll = LoadLibrary("myfile.dll"); if(myDll) { //obtain the function address function1 = (function1_ptr)GetProcAddress(myDll,"function1"); } //use function where needed, but check before if(function1) function1(); //finally free library FreeLibrary(myDll); return 0; }
Last edited by kv79; Dec 21st, 2007 at 8:23 pm.
•
•
Join Date: Nov 2007
Posts: 290
Reputation:
Solved Threads: 7
Hi,
I am really sorry it is my mistake.
It is working ,i get a message only when i put a
dll in same directory where is my exe and correct the names of .dll look up there code.
Thank you all for your effort for trying help me but basicly i needed to help my self.
But one or two more question 's what i do not understand.
1)When i writeing program in other language can i use dll or not?
2)It is his mistake or MSND
http://www.apitalk.com/document.php?id=1184209001_1
http://support.microsoft.com/kb/815065
Because he call this EXPLICITE and but msdn not.
3)MSND call load-time dyna... EXPLICIT
is it mind that run-time dyna... IMPLICIT?
4)When i use load-time is it mind when i load first time i do not need anymore dll?
5)Can i use any windows XP dll's?
6)What i need to do to attach another dll with this one?Do i need any other knowlage?
7)
if(function1)
function1();
Why the program won't work right without this ?
8)How to create different moduls in point of
runing faster programs.OR separate moduls.
9)I downloaded Visual C++ 2005 Expres Edition ,why i can't make a project ,what to do reslove that?
I am really sorry it is my mistake.
It is working ,i get a message only when i put a
dll in same directory where is my exe and correct the names of .dll look up there code.
Thank you all for your effort for trying help me but basicly i needed to help my self.
But one or two more question 's what i do not understand.
1)When i writeing program in other language can i use dll or not?
2)It is his mistake or MSND
http://www.apitalk.com/document.php?id=1184209001_1
http://support.microsoft.com/kb/815065
Because he call this EXPLICITE and but msdn not.
3)MSND call load-time dyna... EXPLICIT
is it mind that run-time dyna... IMPLICIT?
4)When i use load-time is it mind when i load first time i do not need anymore dll?
5)Can i use any windows XP dll's?
6)What i need to do to attach another dll with this one?Do i need any other knowlage?
7)
if(function1)
function1();
Why the program won't work right without this ?
8)How to create different moduls in point of
runing faster programs.OR separate moduls.
9)I downloaded Visual C++ 2005 Expres Edition ,why i can't make a project ,what to do reslove that?
Last edited by kv79; Dec 22nd, 2007 at 1:16 pm.
>>I downloaded Visual C++ 2005 Expres Edition ,why i can't make a project ,what to do reslove that?
To create a project: select menu File -->New -->Project, then set Project Type to Win32 and Visual Studio Installed Templates to Win32 Console Application. At the bottom of the screen enter the project name and select the desired location. Finally on that window press the Ok button.
The next window to appear is the Application Settings window. Select Console Application and press the Finish button.
All done.
To create a project: select menu File -->New -->Project, then set Project Type to Win32 and Visual Studio Installed Templates to Win32 Console Application. At the bottom of the screen enter the project name and select the desired location. Finally on that window press the Ok button.
The next window to appear is the Application Settings window. Select Console Application and press the Finish button.
All done.
Last edited by Ancient Dragon; Dec 22nd, 2007 at 7:12 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
1)When i writeing program in other language can i use dll or not?
Yes, you can use a DLL in any language. The trick is only to match the correct "calling convention". Google it and read more about it. Most Windows DLLs have "stdcall" calling convention.
2)It is his mistake or MSND ... Because he call this EXPLICITE and but msdn not.
Both are correct. The difference between explicit and implicit linking is just whether or not the compiler links for you. For example, when writing windows programs, if you include <windows.h> then you can use all kinds of functions found in Windows DLLs without having to explicitly say which DLLs you want to use.
3)MSND call load-time dyna... EXPLICIT is it mind that run-time dyna... IMPLICIT?
This is non-sequitur. If you use LoadLibrary() then that is run-time loading. Otherwise it is load-time loading. This is a fairly simple, but technical issue. You shouldn't need worry about it.
The main interest for the programmer is that if a load-time DLL is not found, your program will not run. However, a run-time DLL (loaded with LoadLibrary()) allows you to choose whether to continue execution or not.
4)When i use load-time is it mind when i load first time i do not need anymore dll?
I don't understand your question.
5)Can i use any windows XP dll's?
Sure, why not?
6)What i need to do to attach another dll with this one?Do i need any other knowlage?
DLLs are separate things. One DLL may use another DLL, just as your EXE may use a DLL, but they are still separate, self-contained things.
7)
if(function1)
function1();
Why the program won't work right without this ?
It is possible that the DLL you loaded doesn't have the requested function. You must check to make sure that the function exists before you use it.
Keep in mind that you are really using a C shortcut here. "function1" is a pointer to a function. So first you test to see if the pointer is not NULL, and if not, then you call the function. To be absolutely explicitly correct it should read:
C and C++ are nice and let you write it a shorter way:
8)How to create different moduls in point of runing faster programs.OR separate moduls.
It makes no difference. (That is, if I understand your question correctly.)
Good luck!
Yes, you can use a DLL in any language. The trick is only to match the correct "calling convention". Google it and read more about it. Most Windows DLLs have "stdcall" calling convention.
2)It is his mistake or MSND ... Because he call this EXPLICITE and but msdn not.
Both are correct. The difference between explicit and implicit linking is just whether or not the compiler links for you. For example, when writing windows programs, if you include <windows.h> then you can use all kinds of functions found in Windows DLLs without having to explicitly say which DLLs you want to use.
3)MSND call load-time dyna... EXPLICIT is it mind that run-time dyna... IMPLICIT?
This is non-sequitur. If you use LoadLibrary() then that is run-time loading. Otherwise it is load-time loading. This is a fairly simple, but technical issue. You shouldn't need worry about it.
The main interest for the programmer is that if a load-time DLL is not found, your program will not run. However, a run-time DLL (loaded with LoadLibrary()) allows you to choose whether to continue execution or not.
4)When i use load-time is it mind when i load first time i do not need anymore dll?
I don't understand your question.
5)Can i use any windows XP dll's?
Sure, why not?
6)What i need to do to attach another dll with this one?Do i need any other knowlage?
DLLs are separate things. One DLL may use another DLL, just as your EXE may use a DLL, but they are still separate, self-contained things.
7)
if(function1)
function1();
Why the program won't work right without this ?
It is possible that the DLL you loaded doesn't have the requested function. You must check to make sure that the function exists before you use it.
Keep in mind that you are really using a C shortcut here. "function1" is a pointer to a function. So first you test to see if the pointer is not NULL, and if not, then you call the function. To be absolutely explicitly correct it should read:
if (function1 != NULL) (*function1)();C and C++ are nice and let you write it a shorter way:
if (function1) function1();8)How to create different moduls in point of runing faster programs.OR separate moduls.
It makes no difference. (That is, if I understand your question correctly.)
Good luck!
![]() |
Similar Threads
- How Do I . . . Make a Class Accessible from a DLL (C++)
- Console application and MFC-DLL application (C++)
- Localization application (C++)
- DLL in C For Vbasic (Visual Basic 4 / 5 / 6)
- static and dynamic Dll (C++)
- Export Obejct from DLL (C++)
- How to use interface of a dll which is developed in C#>NET in my VC++.NET appli (C++)
- Faulting application msimn.exe (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: Help reading/writing to text files...
- Next Thread: Read a text file
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game getline givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node output parameter pointer problem program programming project proxy python read recursion recursive reference return rpg string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






