1
votes

I've been goobing around with FreePascal and made a simple test DLL.

library dll;

function addstuff(onenumber, twonumber : Integer) : integer; stdcall;

begin
     addstuff := onenumber + twonumber;
end;


begin
end.

exports addstuff;

However, when I try to import it into Python using Ctypes, it claims that there is no function addstuff in the dll. The DLL Export Viewer says there are no functions in it at all either.

I can't seem to find any simple tutorials for building a DLL on the internet, so I'm most likely doing something stupidly wrong. Any tips? I'm pretty new to Pascal.

1

1 Answers

2
votes

You have the exports section outside the program, put it inside

library dll;

function addstuff(onenumber, twonumber : Integer) : integer; stdcall;

begin
     addstuff := onenumber + twonumber;
end;

exports addstuff;    

begin
end.