是否可以使用没有LIB文件的DLL文件? [英] Is it possible to use the DLL file without its LIB file?

查看:130
本文介绍了是否可以使用没有LIB文件的DLL文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我正在尝试使用名为mp4core.dll的DLL文件将图像流编码为视频

但是我没有库对于这个DLL



我也尝试打开这个DLL并查看它的功能,但我没有告诉我任何关于这些函数中使用的参数或如何使用它们



我在互联网上找到了类似的功能

Hello everyone
I'm trying to use a DLL file called mp4core.dll to encode a stream of images to video
but i don't have the library for this DLL

I also tried to open this DLL and view its functions and I did but it didn't tell me anything about the parameters used in these functions or how to use them

I've found a similar function on the internet

xvid_encoder(void* handle, int opt, void* param1, void* param2);



但我不知道如何使用它或从哪里获取这些参数

知道我得到的是LPBYTE原始图像数据,我将其保存为txt文件。



我还有一个XVID类互联网现在还没有如何获得参数


but i didn't know how to use it or where to get these parameters
Knowing that all I get is an LPBYTE raw image data that I save to a txt file.

I also founs an XVID class on the internet also didn't now how to get the parameters

void init_encoder(uint32_t cpu_flags);

int enc_create(xvid_enc_create_t * create);
int enc_destroy(Encoder * pEnc);
int enc_encode(Encoder * pEnc,xvid_enc_frame_t * pFrame, xvid_enc_stats_t * stats);





我可以在没有库的情况下使用DLL吗?

有谁知道如何使用ready函数?或者从哪里获取参数?



谢谢。



Can I use the DLL without the Library?
Does anyone know how to use the ready functions? or where to get the parameters?

Thank you .

推荐答案

技术上:您可以使用 DLL ,而无需使用其导入库( .lib 文件),通过DLL显式链接 [ ^ ]。但是,如果您没有 DLL 头文件( *。h ),那就是你没有知道 DLL 的函数签名,然后你的任务非常困难。
Technically yes: you might use a DLL without having its import library (.lib file), via DLL explicit linking[^]. However, if you don't have the DLL header file (*.h), that is you don't know DLL's function signatures, then your task is extremely hard.


你可以通过解构装饰名称 [ ^ ]。但是,没有库的文档,不太可能对你有所帮助。例如,知道参数1是 int 而参数2是 char * 没有提供关于什么值的信息可以接受。
You can figure out the basic information by deconstructing the decorated names[^]. However, without the documentation for the library that is unlikely to help you much. For example, knowing that parameter 1 is an int and parameter 2 is a char* gives no information as to what values are acceptable.


正如解决方案#1和2告诉你的那样,你需要.lib文件正确链接。



如果你没有这个,你可以建立一个假的。这需要相当多的工作。您可以使用depends.exe之类的应用程序查看dll,以获取dll的所有入口点。使用undname,将装饰的名称转换为源中预期的名称。然后构建一组伪造的类和全局API,并编译/链接到一组dll / lib文件中。丢弃假dll,但使用假的lib文件链接你感兴趣的dll。



你没有说你有哪个版本的Visual Studio(如果你有的话)它一点都没有。假设您有VS2010,可以在开始时找到depends.exe - > Microsoft Visual Studio 2010 - > Visual Studio工具 - >可以通过打开Start - >找到depends.exe和undname作为命令行工具。 Microsoft Visual Studio 2010 - > Visual Studio工具 - > Visual Studio命令提示符(2010)。如果你有不同的Visual Studio版本,细节当然会有所不同。



打开depends.exe并查看你的dll。导出列表位于右下方窗格中。转到VS命令提示符,并使用undname查看该列表中每个Function名称的未修饰名称:



D:\ blahblah \ VC> undname ?? 0BaseMessage @@ QAE @ XZ

Microsoft(R)C ++名称Undecorator

版权所有(C)Microsoft Corporation。保留所有权利。



未装饰: - ?? 0BaseMessage @@ QAE @ XZ

是: - public:__ thishisall BaseMessage :: BaseMessage(void)



使用所有这些入口点构建你的假dll。在假dll上使用depends.exe以确保它与真实的dll匹配。根据您的链接方式,您可能需要注意或不必注意序数。如有必要,请使用.def文件以获得正确的(如果需要)。你可以通过定义感兴趣的入口点来逃脱。这可能是一个迭代过程。你会花很多时间来做这件事。



如果你有这些细节,请使用假的.lib文件将你的应用链接到感兴趣的.dll 。



Bazinga!
As solutions #1 and 2 tell you, you need the .lib file to link properly.

If you don't have this, you can build a fake one. It will take a considerable amount of work. You can look at the dll with an app such as depends.exe to get all the entry points to the dll. Using undname, back translate the decorated names to what is expected in source. Then build a fake set of classes and global APIs and compile/link into a set of dll/lib files. Throw away the fake dll but use the fake lib file to link your dll of interest.

You didn't say which version of Visual Studio you have (if you have it at all). Assuming you have VS2010, depends.exe can be found at Start -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> depends.exe and undname can be found as a command line tool by opening Start -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt (2010). If you have a different Visual Studio version, the details will of course be a little different.

Open depends.exe and look at your dll. The list of exports is found on the lower right pane. Go to the VS command prompt, and use undname to see the undecorated name of each "Function" name in that list:

D:\blahblah\VC> undname ??0BaseMessage@@QAE@XZ
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "??0BaseMessage@@QAE@XZ"
is :- "public: __thiscall BaseMessage::BaseMessage(void)"

Build your fake dll with all of these entry points present. Use depends.exe on the fake dll to make sure that it matches with the real one. Depending on how you link, you may or may not have to pay attention to the ordinal numbers. Use a .def file if necessary to get these right (if you need them). You can probably get away with just defining the entry points of interest. This will likely be an iterative process. You will spend a lot of time getting this right.

When you have these details right, use the fake .lib file to link your app to the .dll of interest.

Bazinga!


这篇关于是否可以使用没有LIB文件的DLL文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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