问题开始的程序与嵌入的资源的dll [英] Problem starting program with a dll embedded as a resource

查看:158
本文介绍了问题开始的程序与嵌入的资源的dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经完成了 About.com指南,将Delphi嵌入到Delphi EXE的似乎工作,只要我实际上不使用DLL作为外部函数。有没有得到我链接到的代码比使用条款中引用的单位早。

我试过:

I've done About.com guide to embedding dll's in Delphi EXE's which seems to work, so long as I don't actually use the DLL as an external function. Is there anyway to get the code I linked to to work earlier than an unit referenced in the uses clause.
I've tried:


  • 正好完成这段代码所述。

  • 将此代码放在使用使用外部函数的单元的表单的初始化部分。

  • 将此代码放在使用外部函数的单元的初始化部分。

通过外部函数我' m指的是一个函数,如下所示:

And by external functions I'm referring to a function that looks like:

function MyFunction: Integer; stdcall; external 'fundll.dll';

我得到的问题是通常的fundll.dll无法加载(因为它不是在目录中)。当代码达到这个目标时,Zarko的代码工作(非常甜蜜,它会在该文件夹中创建dll)。但是当我使用我需要的外部函数之前,这个项目甚至会在滚动之前崩溃。

The problem I'm getting is the usual 'fundll.dll' cannot be loaded (because it's not in the directory) . Zarko's code works (pretty sweet, it creates the dll in that folder) when the code gets that far. But it just crashes before the project even gets rolling when I'm using the external functions I need.

推荐答案

如果你想调用一个函数,你有两个选择...

if you want to call a function in it, you have two choices ...

1)使用一个exe / dll bundler而不是资源方法。
2)不要使用外部样式声明链接到库。而是使用LoadLibrary,GetProcAddress等引用您需要调用的函数。

1) use an exe/dll bundler instead of the resource method. 2) don't link to the library with the external style declaration. instead use LoadLibrary, GetProcAddress, etc to reference the function you need to call.

资源方法和函数的声明不会混合。窗口想要将您的exe链接到内存中的dll 之前,您的代码运行以提取dll。

the resource method and the declaration of the function as external will not mix. windows wants to link your exe to the dll in memory before your code runs to extract the dll.

这篇关于问题开始的程序与嵌入的资源的dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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