|
|
导航: |
论坛 -> DELPHI技术
斑竹:liumazi,sephil |
|
作者: |
yam (yam) |
★☆☆☆☆ |
-
|
盒子活跃会员 |
|
2023/3/24 20:05:26 |
标题: |
现在有能在delphi 11上用的从内存中调用dll的方法么? |
浏览:429 |
|
加入我的收藏 |
楼主: |
尝试了3种方法 武稀松老师的内存加载模块 dsplayer的MemoryModule 调用时候都会出错, 不知道为什么
现在有方法能实现吗?
谢谢。
----------------------------------------------
- |
作者: |
|
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.
还请老师帮忙看看。
----------------------------------------------
-
|
作者: |
|
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
----------------------------------------------
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都没问题,一用就报错。。。。
感谢回复了。
----------------------------------------------
-
|
|