473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why need .dll if I use static lib?

Hi!
Please be patient with a newbie...

I use DevC++.
I've found and compiled succefully various openGL examples.
Before build the application, I link the project with static libs,
like, in example, libglut32.a.

The executables running fine, but if I try them on a system without
glut32.dll, they don't start.

I'm a bit confused about libraries: if I use static libs, all code
should be included in final executable, right? ...so if I use
libglut32.a, why is needed glut32.dll?

I assume I'm compiling using static libs, because if I don't add the
libglut.a to project, the compiler return a link error. Besides I don't
see, in DevC++, an option like "compile using dynamic libs" and
goggling, I've found an article that explain that, to use dynamic libs,
it's needed a special code, like:

HMODULE LoadLibrary(LPC STR lpFileName);
FARPROC GetProcAddress( HMODULE hModule, LPCSTR lpProcName);
BOOL FreeLibrary(HMO DULE hModule);
etc...

And lines like these are not in files I'm compiling...

I've found a definition of static libs:
---------------
Just a collection of pre-compiled material declared in the relevant
header files. Needed by the linker. Include into the project.
---------------

So I can compile separately various cpp files, that contains all
functions definitions, to obtain various .o
Finally I compile all into a static lib, that is like "zipping" all .o
in a sort of special compressed file.

So, the .a has ALL I NEED! All objects are into the .a, so the .dll is
not needed...

I've just try to compile a simple static lib and use it in a basic
project...it work, without dll!

An example here:
http://www.crasseux.com/books/ctutor...a-library.html

but using DevC++ is more simple, just choose "static lib" in project
option and compile it.
Later, make a new project that use some functions defined in lib, and
compile it after added the lib to project...

So, I don't understand what happen when I link the linglut32.a or
opengl.a, and why the application need anyway glut32.dll and
opengl32.dll...

Thanks,

Manuel

Jan 12 '06 #1
5 5090
On 12 Jan 2006 03:54:52 -0800, "in**@dedal o-3d.com"
<in**@dedalo-3d.com> wrote:
Hi!
Please be patient with a newbie...

I use DevC++.
I've found and compiled succefully various openGL examples.
Before build the application, I link the project with static libs,
like, in example, libglut32.a.

The executables running fine, but if I try them on a system without
glut32.dll, they don't start.

I'm a bit confused about libraries: if I use static libs, all code
should be included in final executable, right? ...so if I use
libglut32.a, why is needed glut32.dll?


This is off-topic - it's not a C++ language question. Ask somewhere
more appropriate, and search Google for "import library".
Jan 12 '06 #2
<in**@dedalo-3d.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Hi!
Please be patient with a newbie...

I use DevC++.
I've found and compiled succefully various openGL examples.
Before build the application, I link the project with static libs,
like, in example, libglut32.a.

The executables running fine, but if I try them on a system without
glut32.dll, they don't start.

I'm a bit confused about libraries: if I use static libs, all code
should be included in final executable, right? ...so if I use
libglut32.a, why is needed glut32.dll?

I assume I'm compiling using static libs, because if I don't add the
libglut.a to project, the compiler return a link error. Besides I don't
see, in DevC++, an option like "compile using dynamic libs" and
goggling, I've found an article that explain that, to use dynamic libs,
it's needed a special code, like:

HMODULE LoadLibrary(LPC STR lpFileName);
FARPROC GetProcAddress( HMODULE hModule, LPCSTR lpProcName);
BOOL FreeLibrary(HMO DULE hModule);
etc...

And lines like these are not in files I'm compiling...

I've found a definition of static libs:
---------------
Just a collection of pre-compiled material declared in the relevant
header files. Needed by the linker. Include into the project.
---------------

So I can compile separately various cpp files, that contains all
functions definitions, to obtain various .o
Finally I compile all into a static lib, that is like "zipping" all .o
in a sort of special compressed file.

So, the .a has ALL I NEED! All objects are into the .a, so the .dll is
not needed...

I've just try to compile a simple static lib and use it in a basic
project...it work, without dll!

An example here:
http://www.crasseux.com/books/ctutor...a-library.html

but using DevC++ is more simple, just choose "static lib" in project
option and compile it.
Later, make a new project that use some functions defined in lib, and
compile it after added the lib to project...

So, I don't understand what happen when I link the linglut32.a or
opengl.a, and why the application need anyway glut32.dll and
opengl32.dll...


I believe the answer is that the static lib you are linking to is calling
the dynamic library itself.

Althought this is really a windows questions, you should try in
microsoft.publi c.vc.language as I could be totally wrong.
Jan 12 '06 #3
On 12 Jan 2006 03:54:52 -0800, "in**@dedal o-3d.com"
<in**@dedalo-3d.com> wrote:
Hi!
Please be patient with a newbie...


There are helpful people in the newsgroups below:

comp.graphics.a lgorithms
comp.graphics.a pi.opengl

Good Luck
Jan 12 '06 #4
> So, I don't understand what happen when I link the linglut32.a or
opengl.a, and why the application need anyway glut32.dll and
opengl32.dll.. .


Quick reply only as you're off-topic: under Windows, you need to link
with a .lib / .a when you're calling a DLL - basically, the lib
resolves the linker symbols for the DLL functions - telling it to load
them from the DLL at startup; hence you still need the DLL. LoadLibrary
etc. is usually needed if you only know which DLLs are needed at
runtime [not the case here].

Jan 12 '06 #5
Paul Henderson wrote:
Quick reply only as you're off-topic: under Windows, you need to link
with a .lib / .a when you're calling a DLL - basically, the lib
resolves the linker symbols for the DLL functions - telling it to load
them from the DLL at startup; hence you still need the DLL. LoadLibrary
etc. is usually needed if you only know which DLLs are needed at
runtime [not the case here].


Thanks!
Jan 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1702
by: SteveM | last post by:
This is probably an easy answer but since I am fairly new to C++ for some reason I can't see it :-( Any help would be appreciated :-) I have a class: class AClass { public:
11
1849
by: Matthew | last post by:
Ok let me try to explain this as good as I can. I am creating this application where it contains a userlogin class. The user logs in before entering the main apploication. I want to do audit trails and I am trying to figure out how to get the user ID that logged in. Can anyone help me. I have samples if anyone needs them.
0
1217
by: jhhbr549 | last post by:
Need to write a class called Sales that is extends from a super class called Employee. I feel like I am going in the wrong direction. look at this: Here are the specs: static double field values - BEST_COMMISSION, HIGH_COMMISSION, HIGH_SALES, LOW_COMMISSION,LOW_SALES, QUOTA_COMMISION, QUOTA_SALES. I believe I have the main constructor...
32
3027
by: lcdgoncalves | last post by:
Hi everyone Is there a real need to use keyword static with functions, if we simply don't declare their prototypes in .h file? Many textbooks avoid to discuss this matter and/or discuss only the usage of static functions. I've been programming for years and I never felt a real need for the "static approach for functions". I don't know...
8
2726
by: manmit.walia | last post by:
Hello Everyone, Long time ago, I posted a small problem I had about converting a VB6 program to C#. Well with the help with everyone I got it converted. But I overlooked something and don't understand why it is doing this. Below is my code, I would be greatfull if someone can guide me through the right path or even help me solve this issue. ...
13
5774
by: PinkBishop | last post by:
I am using VS 2005 with a formview control trying to insert a record to my access db. The data is submitted to the main table no problem, but I need to carry the catID to the bridge table CatalogImage where imgID also needs to be placed. Below is my code behind to carry the catID using the Select @@Identity and insert imgID to the bridge...
19
2708
by: subramanian100in | last post by:
Stroustrup, in his book TC++PL 3rd Edition, in page 16, under the section '1.8 Advice' has mentioned the following: Don't use global data(use members) Don't use global functions Don't use public data members. Don't use friends, except to avoid or . Consider the following scenarios: Scenario 1:
0
1449
by: doobybug | last post by:
Hi all, I really need your help! I am new to java and have some problems with my code. I have a program which inputs questionnaires and creates an object for each questionnaire. These objects are then saved in a vector which in turn is then encoded in an XML file. For all this I have made a class called MainInput. The problem is with MainOutpu...
9
3234
by: Tool69 | last post by:
Hi, Until now, I was running my own static site with Python, but I'm in need of dynamism. After reading some cgi tutorials, I saw Joe Gregorio's old article "Why so many Python web frameworks?" about wsgi apps and have a question about it. The code he gave works like a charm (I had to make a little change because SQLAlchemy has changed...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.