- 论坛徽章:
- 0
|
dll,很简单,2个函数代码如下:
library Project1;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
SysUtils,
Classes;
{$R *.RES}
function PlusNum(x,y:integer):integer;stdcall;
begin
result:=x+y;
end;
function MinusNum(x,y:integer):integer;stdcall;
begin
result:=x-y;
end;
exports
PlusNum index 1,
MinusNum index 2;
begin
end. |
在python shell里这样调用
mydll=ctypes.cdll.LoadLibrary('project1.dll')
mydll.PlusNum(1,2)
提示出错,请问该如何调用?
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ValueError: Procedure called with not enough arguments (8 bytes missing) or wrong calling convention
>>> |
|