DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: tino0914
今日帖子: 30
在线用户: 14
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 yam (yam) ★☆☆☆☆ -
盒子活跃会员
2023/3/24 20:05:26
标题:
现在有能在delphi 11上用的从内存中调用dll的方法么? 浏览:682
加入我的收藏
楼主: 尝试了3种方法
武稀松老师的内存加载模块
dsplayer的MemoryModule
调用时候都会出错,
不知道为什么

现在有方法能实现吗?

谢谢。
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2023/3/24 22:19:37
1楼: can you show your code?
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 yam (yam) ★☆☆☆☆ -
盒子活跃会员
2023/3/25 8:25:31
2楼: 上贴忘说了,第三种方法:https://www.delphibasics.info/home/delphibasicssnippets/udllfrommem-loadadllfrommemory
这个方法会让 WIN11 系统的defender报毒

我用的代码是参考
http://mrxray.on.coocan.jp/Delphi/plSamples/001_UseDLLProject.htm
中第8 和第9个部分
就是武稀松老师和dsplayer的方法

用他的代码,用自己的dll加到资源文件中,
区别有两处
一处就是我的rc文件内容是:
mydll dllfile dlltest.dll

调用时候
if FindResource(hInstance, 'mydll ', ‘dllfile ’) = 0 then exit;

LResStream := TResourceStream.Create(hInstance, 'mydll ', ‘dllfile ’);


第二处不一样就是函数调用的参数定义
FShowDlgFunc : function (afile, AText: PansiChar): pansichar; stdcall;


以上是不同的地方


这3种方法出错的信息是一样的:
Integer overflow.

还请老师帮忙看看。
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2023/3/25 9:48:48
3楼: I see that the code it's very complex... then look my sample.

FMX project... RAD 11.x

var
  // it's a function-var
  LMyFunctionExportedFromDLL: function: Integer; // <--- same header than your function in DLL
----------


1) LoadLibrary( 'DLL path' ... ) = to load your DLL with your necessity
LMyDLLHandle := LoadLibrary('..\MyDLL\LibraryFMXForm.dll');

if (LMyDLLHandle <> 0) then ... = OK 

2) GetProcAddress( LMyDLL_Handle, '...name of function exported in DLL... ');

LMyFunctionExportedFromDLL := GetProcAddress(LMyDLLHandle, 'MyCreateAndShowForm');

   LModalResult := LMyFunctionExportedFromDLL;


look my sample: done in RAD 11.x
此帖子包含附件:emailx45_202332594848.zip 大小:86.0K
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 yam (yam) ★☆☆☆☆ -
盒子活跃会员
2023/3/25 18:11:47
4楼: 看来可能是我的dll的问题了,不用这个dll都没问题,一用就报错。。。。

感谢回复了。
----------------------------------------------
-
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行70.3125毫秒 RSS