| | |
pragma
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Mar 2007
Posts: 21
Reputation:
Solved Threads: 1
i was just going through some source code and came across the directive
I got mixed and confusing answers when i read about it in the vc++ documentation. Could someone please explain clearly the purpose or necessity for such code? I do have a hunch it has something to do with linking !!
C++ Syntax (Toggle Plain Text)
#pragma comment( lib, "irrlicht.lib" );
I got mixed and confusing answers when i read about it in the vc++ documentation. Could someone please explain clearly the purpose or necessity for such code? I do have a hunch it has something to do with linking !!
>Could someone please explain clearly the purpose or necessity for such code?
If you're using code from an external library, you usually have to link a special .lib file. Usually how it's done in most IDEs is there's special configuration options, which allow you to specify the .libs to link with.
The #pragma is a compiler-specific feature to allow you to link the libs without going into the linker config.
If you're using code from an external library, you usually have to link a special .lib file. Usually how it's done in most IDEs is there's special configuration options, which allow you to specify the .libs to link with.
The #pragma is a compiler-specific feature to allow you to link the libs without going into the linker config.
"Technological progress is like an axe in the hands of a pathological criminal."
•
•
Join Date: Mar 2007
Posts: 21
Reputation:
Solved Threads: 1
Ah, now i get it. instead of that statement, i added the .lib file in the linker input options of the solution in vc++ express and commented the statement. It built and ran normally.
Now what you said would suffice for lib files. How do i link a dll file? is there a directive to link a dll file using compiler specific feature or is it a setting in the IDE. And would it be possible to elaborate the difference between a lib file and dll (.so in linux ).
i already vaguely understand! but im confused about which calls which. does the dll call lib files or lib calls dll files. Or do neither call each other, but for the source code... which calls either one or both.
Now what you said would suffice for lib files. How do i link a dll file? is there a directive to link a dll file using compiler specific feature or is it a setting in the IDE. And would it be possible to elaborate the difference between a lib file and dll (.so in linux ).
i already vaguely understand! but im confused about which calls which. does the dll call lib files or lib calls dll files. Or do neither call each other, but for the source code... which calls either one or both.
>Now what you said would suffice for lib files. How do i link a dll file?
DLL stands for Dynamic Link Library. So they aren't linked at compile time, they are dynamically linked when you run the program.
Usually how it tends to work is that a library will come with 2 parts: .lib and .dll. You add the .lib to the linker options, and the operating system takes care of the rest. Of course, there are other situations where the entire library is statically linked, in which case no DLL is necessary (just the .lib). But I have never used statically-linking libraries in the Windows environment, so I may not be entirely correct.
DLL stands for Dynamic Link Library. So they aren't linked at compile time, they are dynamically linked when you run the program.
Usually how it tends to work is that a library will come with 2 parts: .lib and .dll. You add the .lib to the linker options, and the operating system takes care of the rest. Of course, there are other situations where the entire library is statically linked, in which case no DLL is necessary (just the .lib). But I have never used statically-linking libraries in the Windows environment, so I may not be entirely correct.
"Technological progress is like an axe in the hands of a pathological criminal."
•
•
Join Date: Mar 2007
Posts: 21
Reputation:
Solved Threads: 1
how does the OS know that the dll can be found in a particular place, may i ask?. In the IDE settings I explicitly set the extra include directories and extra lib directories. But i see no provision for extra dll directories. so how does the OS know where to search for the dll file it requires ?
Last edited by desijays; Apr 5th, 2007 at 12:35 am.
•
•
•
•
how does the OS know that the dll can be found in a particular place, may i ask?. In the IDE settings I explicitly set the extra include directories and extra lib directories. But i see no provision for extra dll directories. so how does the OS know where to search for the dll file it requires ?
"Technological progress is like an axe in the hands of a pathological criminal."
•
•
Join Date: Mar 2007
Posts: 21
Reputation:
Solved Threads: 1
The fact that the OS checks in the directory of the .exe is the only thing im sure off. cos up until now, thats the only way i solve the "xxxxx.exe cannot run cos xxxxxx.dll could not be found" dialogs when they pop up.
thanks for clearing some of my doubts mate. I know, that I know more about lib and dll files than 5 posts ago ;-). albeit i also know there is truck loads to learn yet.
thanks for clearing some of my doubts mate. I know, that I know more about lib and dll files than 5 posts ago ;-). albeit i also know there is truck loads to learn yet.
It's probably best to leave the Irrlicht dll file in the directory that your application resides in. I couldn't find any information on Irrlicht's web page on where to install the dll, and I haven't used Windows recently enough to remember the directory where all of them are stored.
And I wouldn't worry about it too much, having dlls with your program's executable is fine.
And I wouldn't worry about it too much, having dlls with your program's executable is fine.
"Technological progress is like an axe in the hands of a pathological criminal."
![]() |
Similar Threads
- visual c++ strange compile error... (C++)
- about #pragma (C++)
- "missing storage-class or type specifiers" error (C++)
- Error Linking KeyLogger.exe (C++)
Other Threads in the C++ Forum
- Previous Thread: User-Defined Function - part 2
- Next Thread: Linker Error
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






