如何使用dll的? [英] How to use dll's?

查看:132
本文介绍了如何使用dll的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如果我有一个.a或.so文件和该库的头文件(例如SystemC),我应该
1. include头文件
2.链接适当的图书馆。

I know that if I have an .a or .so file and a header file for that library (for example for SystemC), I should 1. include header file 2. link the appropriate library.

但我不能处理只有.dll文件,因为我可以链接它,但没有一个收集文件包括和使用命令。有人解释我什么样的.dll存在,它们如何可能使用?是否可以使用任何.dll文件,或者它应该是一个特定的.dll文件,以便能够集成到我的应用程序?

But I can't handle with only .dll file as I can link it as well, but don't have a hearer file to include and to use commands. Con someone explain me what kind of .dll-s exist and how they are possible to use? Is it possible to use any .dll file or it should be a specific kind of .dll to be able to integrate to my application?

推荐答案

DLL在功能上等同于.so文件(也称为共享对象或共享库)。您需要一个头来声明DLL中可用的函数,并且需要链接一个库,该库处理加载和执行DLL调用(主要委托给操作系统)的业务。

A DLL is functionally equivalent to a .so file (also know as a 'shared object' or 'shared library'). You need a header to declare the functions that are available inside the DLL and you need to link against a library which handles the business of loading and executing DLL calls (mostly delegated to the OS).

是可以使用没有任何标题的DLL。你可以直接调用Win32 API,它将动态加载一个DLL到你的程序虚拟地址空间,并调用其他API,这将给你本质上是函数指针。然而,你需要知道函数指针的签名以正确使用,所以你在这种情况下有效地做的是声明一个微小的实际DLL头部分,供你使用。

It is possible to use a DLL without any sort of header. You can directly call Win32 API's which will dynamically load a DLL into your programs virtual address space and call other API's which will give you what are essentially function pointers. However, you need to know the signatures of the function pointers to use the properly so what you're effectively doing in that case is declaring a tiny subsection of the actual DLL header for your use.

维基百科文章< a>可能会有帮助,特别是有关共享库的部分

This wikipedia article may help, especially the section on shared libraries

这篇关于如何使用dll的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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