please give me the difference in using export and stdcall keywords for exporting the functions in Dll using delphi7

久未见 提交于 2019-12-24 09:18:56

问题


uses
  SysUtils,
  Classes;

{$R *.res}
function add(Value1:integer;value2:integer):integer;stdcall;
begin
  Result:=Value1+value2;
end;

function subtract(Value1:integer;value2:integer):integer;stdcall;
begin
  Result:=Value2-value1;
end;

function multiply(Value1:integer;value2:integer):integer;stdcall;
begin
  Result:=Value1*value2;
end;

function divide(Value1:integer;value2:integer):integer;stdcall;
begin
  Result:=Value2 div value1;
end;

function check(Value1:integer;value2:integer):Boolean;stdcall;
begin
  if(Value2>value1)then
    Result:=True
  else
    Result:=False;
end;

exports add,subtract,multiply,divide,check;

this is my dll code. even if i give export it works. may i know the difference between the usage of these two keywords.


回答1:


The export keyword is a legacy from 16 bit versions. It is ignored in modern versions of Delphi. Do not confuse it with the exports directive which is used to specify which functions are exported from a library, and which you use correctly in the code presented.

It doesn't make much sense to compare export with stdcall, a calling convention directive, since they are not directly comparable.



来源:https://stackoverflow.com/questions/42359169/please-give-me-the-difference-in-using-export-and-stdcall-keywords-for-exporting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!