不行的。 比如C++ dll中的函数这么声明: //--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstopint WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*) { return 1; }//---------------------------------------------------------------------------extern "C" __declspec(dllexport) int WINAPI Double (int n) { return n * 2; }extern "C" __declspec(dllexport) int WINAPI Triple (int n) { return n * 3; }__declspec(dllexport) int WINAPI Add (int a, int b) { return (a + b); }那么相应Delphi中要翻译过来,才能使用:{definition of the functions of the DLL} function Add (A, B: Integer): Integer; stdcall; external 'CPPDLL.DLL' name '@Add$qqsii'; function Double (N: Integer): Integer; stdcall; external 'CPPDLL.DLL' name 'Double'; function Triple (N: Integer): Integer; stdcall; external 'CPPDLL.DLL';
比如C++ dll中的函数这么声明:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstopint WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
{
return 1;
}//---------------------------------------------------------------------------extern "C" __declspec(dllexport)
int WINAPI Double (int n)
{
return n * 2;
}extern "C" __declspec(dllexport)
int WINAPI Triple (int n)
{
return n * 3;
}__declspec(dllexport)
int WINAPI Add (int a, int b)
{
return (a + b);
}那么相应Delphi中要翻译过来,才能使用:{definition of the functions of the DLL}
function Add (A, B: Integer): Integer;
stdcall; external 'CPPDLL.DLL' name '@Add$qqsii';
function Double (N: Integer): Integer;
stdcall; external 'CPPDLL.DLL' name 'Double';
function Triple (N: Integer): Integer;
stdcall; external 'CPPDLL.DLL';