为什么我需要glut.h,glut32.lib,glut32.dll ALL来编译openGL程序? [英] why do I need glut.h, glut32.lib, glut32.dll ALL to compile an openGL program?

查看:135
本文介绍了为什么我需要glut.h,glut32.lib,glut32.dll ALL来编译openGL程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,.lib文件是某种编译文件,并且dll文件当然包含其中的所有功能.为什么我不能只处理.lib文件或仅处理.dll文件?为什么说明告诉我要全部拿走这三个?

As far as I know the .lib file is some sort of compiled file and of course the dll file contains all the functions in it anyway. Why can't I just do with the .lib file or just the .dll file? Why do the instructions tell me to get all three of them?

顺便说一句,因为我们有一个"freeGLut",openGL文件还是无法释放吗?

By the way, are openGL files not free anyway that we have a "freeGLut"??

推荐答案

据我所知,.lib文件是某种已编译的文件,当然dll文件仍然包含其中的所有功能.

As far as I know the .lib file is some sort of compiled file and of course the dll file contains all the functions in it anyway.

不,不是那么简单.

DLL是一个可执行二进制文件,减去启动入口点. DLL导出一些符号,但是这些符号是无特征的,仅在地址空间中的位置.编译器无法从标准DLL(或SO)推断出每个符号具有什么 signature .为此,需要通过其他方式以某种方式告知签名.这是头文件(.h).

A DLL is a executable binary, minus an startup entry point. The DLL exports some symbols, but those are featureless, only positions in the address space. A compiler can not deduce from a standard DLL (or SO) what signature each symbol has. For this it needs to be told the signatures in some way through an additional source. This is the header file (.h).

但是,实际上要有用的是,DLL必须在执行时加载到进程中.为此,可执行文件需要增加其他信息,即要加载的DLL.在Windows下,这是通过存根库(.lib)完成的,该存根库仅携带该DLL导入信息.在其他操作系统上,您可以通过将链接程序指向该链接程序来链接到该DLL文件.

However to be actually usefull, the DLL must be loaded into the process upon execution. For this the executable needs to be augmented with additional information, namely what DLL(s) to load. Under Windows this is done using a stub library (.lib), that merely carries that DLL import information. On other OSs you link against the "DLL" by pointing the linker to that one.

为什么我不能只处理.lib文件还是仅处理.dll文件?

Why can't I just do with the .lib file or just the .dll file?

因为.lib不包含实际的代码,而仅包含信息,以使用某个DLL.而且由于Microsoft工具无法从目标DLL中提取其动态链接信息.

Because the .lib doesn't contain actual code but only the information, to use a certain DLL. And because the Microsoft tools can't pull their dynamic linkage information from the target DLLs.

为什么说明告诉我要全部拿走这三个?

Why do the instructions tell me to get all three of them?

因为每个文件都有特定的功能,所以您需要全部三个文件

Because each file has a specific function, and you need all three of them to

  • 获取功能签名(.h)
  • 告诉您的可执行文件以加载特定的DLL(.lib)
  • 并以.dll的形式获取实际的库

顺便说一句,由于我们有一个"freeGLut",openGL文件不是不能释放吗?

By the way, are openGL files not free anyway that we have a "freeGLut"?

GLUT不是OpenGL的一部分.这是一个独立开发的库. OpenGL本身也只是一个规范,没有"the" OpenGL源.只有特定的实现,其中的 some 是免费的.

GLUT is not part of OpenGL. It's a independently developed library. Also OpenGL itself is just a specification and there are no "the" OpenGL sources; there are only particular implementations, of which some are free.

这篇关于为什么我需要glut.h,glut32.lib,glut32.dll ALL来编译openGL程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆