发现个delphi调用vc写的Dll中包括pchar參数奇怪现象 procedure中的第一行语句不能直接调用DLL的函数,否则会执行报错,在之前随意加上条语句就不报错了奇怪! vc的DLL源代码地址 http://blog.csdn.net/lqena/article/details/46357165 Delphi源代码例如以下: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphic…
unit Unit1; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; type TForm1 = class(TForm) btn1: TButton; btn2: TButton; procedure btn1Cli…
最近做一个读市民卡的项目,读卡器公司提供的读市民卡dll是用C++写的. 下面记录一些自己的心得,供需要的朋友参考. 声明dll函数要加上stdcall关键字,否则可能会报地址非法的错误. 代码: unit cMain; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, StdCtrls, ComCtrls,ActiveX, E…
delphi调用C++写的Dll, 当然这个Dll要求是非MFC的Dll, 这样子才能被delphi调用. 根据C++定义函数的情况, Delphi有不同的相对应的处理方法.1. 声明中不加__stdcall,采用VC默认格式__cdecl,但在Delphi中要注明调用格式为cdecl.C++中例子: extern "C" int __declspec(dllexport) add(int x, int y); Delphi中例子: function add(i:Integer; j:…
下午写程序中遇到几个小细节,需要在这里记录一下. ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 QProcess *process = new QProcess(this);     QFileInfo fileinfo(appUrl);       QString appPath = QApplication::applicationDirPath()+SAVEDIR+"/"+fileinfo.fileName();     bool res = pro…
参见: https://blog.csdn.net/weixin_42420155/article/details/81060945 C#写的dll是没有dllMain入口函数的,是一种中间语言,需要.Net运行时进行做本地化工作,因此如果要调用C#写的dll,需要依赖.Net运行时,然而Qt中还无法直接调用.Net运行时,最好的方式是能够在Qt中直接调用C#dll的函数,但是Qt明显只能调用C++写的dll,所以就只能通过编写一个C++的dll导出接口供Qt调用,这个C++编写的dll对C#写…
近来,因工作需要,必须解决Delphi7写的主程序调用C#写的dll的问题.在网上一番搜索,又经过种种试验,最终证明有以下两种方法可行:    编写C#dll的方法都一样,首先在vs2005中创建一个“类库”项目TestDll,using System.Runtime.InteropServices;namespace TestDll{public interface  I TestClass  {     void YourProcedure(stirng param1);}[ClassInt…
 近来,因工作需要,必须解决Delphi7写的主程序调用C#写的dll的问题.在网上一番搜索,又经过种种试验,最终证明有以下两种方法可行:    编写C#dll的方法都一样,首先在vs2005中创建一个“类库”项目TestDll,using System.Runtime.InteropServices; namespace TestDll{     public   interface  I TestClass    {       void YourProcedure(stirng param…
近来,因工作需要,必须解决Delphi写的主程序调用C#写的dll的问题.在网上一番搜索,又经过种种试验,最终证明有以下两种方法可行:    编写C#dll的方法都一样,首先在vs2005中创建一个“类库”项目TestDll,using System.Runtime.InteropServices;namespace TestDll{     public   interface  I TestClass    {       void YourProcedure(stirng param1);…
1. vs 中新建win32 dll 项目   testdll 添加实现文件       test.cpp #include "stdafx.h" #include <iostream>using namespace std;int Add(int plus1, int plus2){ int add_result = plus1 + plus2; return add_result;} 添加模板定义文件 LIBRARY "testdll"EXPORTS…