Delphi Dll示例】的更多相关文章

//MyInt.pas unit MyInt; interface {$IFNDEF MYLIB} function MyAdd(a,b:integer):integer ;stdcall; {$ENDIF} implementation {$IFNDEF MYLIB} function MyAdd; external 'MyLib.dll' name 'MyAdd'; {$ENDIF} end. //MyLib.dpr library MyLib; { Important note about…
delphi dll 源码: library dllres; type char10 = ..] of char; TMydata = packed record id: Integer; name: char10; married: Boolean; salary: Double; end; PMydata = ^TMydata; const RESSTR: ..] of string = ('HELLO', 'COLOR', 'DELPHI', 'shared', 'library'); N…
Pchar是非托管代码,要在.net中调用Delphi dll中的功能,请使用MarshalAs属性告知.net调用PInvoke去转换.net中标准的string类型.如果Delphi dll是Delphi2007以前的版本编译的,则Pchar是Ansi类型:如果Delphi dll是Delphi2009以后的版本编译的,则Pchar是Unicode类型.请看以下实例. Ansi类型: [DllImport("my.dll")] [return: MarshalAs(Unmanage…
http://blog.163.com/bxf_0011/blog/static/35420330200952075114318/ Delphi 动态链接库的动态和静态调用 为了让人能快速的理解 静态调用.动态调用,现在做一个函数封装在一个DLL中,然后在APPLICATION form里面调用这个函数,这个函数处理两个数的和.用代码和图片说话:代码如下 library Project1; { Important note about DLL memory management: ShareMe…
Borland.Delphi.dll Borland Delphi Runtime for .NET Imports Borland.DelphiImports Borland.Delphi.UnitsImports Borland.Vcl Borland.Delphi.Units.System.AnsiEncoding.GetBytes Borland.Vcl.Units.SysUtils.InitPlatformId Borland.Vcl.Units.SysUtils.InitSysLoc…
1,问题描述 最近发现vb6调用delphi DLL中的函数并返回字符串时出现问题,有时正常,有时出现?号,有时干脆导致VB程序退出 -- :: 将金额数字转化为可读的语音文字:1转化为1元 ????@ 元 ???? og\SS_log.txt .eP K : 2,原因分析 delphi中函数声明如下: function ss_ConvertMoney2Str(mmje:double): PChar; stdcall; VB6中对应的函数声明如下: Public Declare Function…
dll传递string实现方法 delphi中dll传递string的实现方法: dll项目uses第一个引用sharemem单元; 调用的项目uses第一个引用sharemem单元; 调用的单元uses第一个引用sharemem单元; ************************************************************** delphi中dll传递string的实现方法:dll项目uses第一个引用sharemem单元;调用的项目uses第一个引用share…
下面以Delphi调用触摸屏动态库xtkutility.dll为例子,说明如何静态加载DLL和动态加载DLL. 直接上代码. 1.静态加载示例 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) btnEnableTouch: TButton; btnDi…
最近做一个读市民卡的项目,读卡器公司提供的读市民卡dll是用C++写的. 下面记录一些自己的心得,供需要的朋友参考. 声明dll函数要加上stdcall关键字,否则可能会报地址非法的错误. 代码: unit cMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, StdCtrls, ComCtrls,ActiveX, E…
//----------------------Delphi------------------- procedure GetSqlData(ASource: PChar; ADest: PChar; ADestSize: Integer); stdcall; var  S: string; begin  if ASource = nil then Exit;  S := Format('%s 路过!',[ASource]);  Move(S[1], ADest^, Min(ADestSize,…