Hello all,
I want to use a DLL writen in Pascal to provide functions for a Excel VBA code:
The example code of my DLL is:
library CE;
{$mode objfpc}
uses
Sysutils;
function level(x1, x2: integer): integer; cdecl; export;
begin
result := x1 + 2*x2;
end;
exports
level name 'level';
end.In VBA, I did the following code:
Public Declare Function dlevel Lib "CE" Alias "level" (ByVal x1 As Integer, ByVal x2 As Integer) As Integer
Function nivel(ByVal x1 As Integer, ByVal x2 As Integer) As Integer nivel = dlevel(x1, x2)
End Function
In the sheet, I did:
=nivel(2;5)
And I got:
#value
I really don't know what to do. Seemlngly, VBA code is correct. I don't know so much about DLLs, would be possible to have a mistake in my Pascal code?
Does someone have any idea?
Best regards,
