ShareMem /与Delphi DLL进行字符串交换 [英] ShareMem/ string-exchanging with Delphi DLL

查看:442
本文介绍了ShareMem /与Delphi DLL进行字符串交换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速我希望 - 我即将深入Delphi 5遗留应用程序,调用一个DLL(也写在D5中),传递一个字符串,DLL可以修改,如果需要的话。



我有DLL和应用程序的代码。粘贴在DLL源代码的顶部是关于使用ShareMem的注释,它需要是项目的uses子句中的第一行等。



如果我将这件事全部移植到D2007,是否有更好(或更现代)的方式获取Delphi应用程序与Delphi DLL共享字符串数据? D5 ShareMem是否仍适用于Delphi 2007应用程序(使用FastMM等)?我甚至没有一个重新编译整个事情的bash - 只是想知道这是否会是一个问题,如果有一个替代/推荐的方式这样做?



FWIW,该DLL完全是第一方(它只用于这个特定的应用程序 - 所以在D2007下重新编译它也不会是一个问题)。 >

解决方案

要使用D2007中包含的FastMM,请在应用程序和DLL项目中使用SimpleShareMem作为第一个单元。



或从SourceForge下载完整的FastMM4,在FastMM4Options.Inc(ShareMM,ShareMMIfLibrary,AttemptToUseSharedMM)中设置Flags,并将FastMM4作为应用程序和DLL项目中的第一个单元。 p>

Quick one I hope - I'm just about to delve into a Delphi 5 legacy app that makes calls to a DLL (also written in D5), passing a string which the DLL can modify if required.

I have the code to both the DLL and the app. Pasted right at the top of the DLL source is a remark about using ShareMem, and it needing to be the first line in the uses clause of the project etc.

If I was porting this whole thing to D2007, is there a better (or more modern) way of getting a Delphi app to share string data with a Delphi DLL? Does the D5 ShareMem stuff still apply to Delphi 2007 applications (with FastMM etc)? I haven't even had a bash at recompiling the whole thing yet - just wondered if this bit was going to be a problem and if there was an alternative/recommended way of doing this?

FWIW, the DLL is totally first party (it's only used by this particular app - so recompiling it under D2007 as well wouldn't be a problem).

解决方案

To use the FastMM included with D2007, use SimpleShareMem as the 1st unit in both your application and the DLL projects.

Or download the full FastMM4 from SourceForge, set the Flags in FastMM4Options.Inc (ShareMM, ShareMMIfLibrary, AttemptToUseSharedMM) and put FastMM4 as the 1st unit in both the application and the DLL projects.

这篇关于ShareMem /与Delphi DLL进行字符串交换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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