Code:
library mydll;
uses
SysUtils, Classes, etc...
{$R *.res}
function myfunction(s1, s2: PChar; I1: Integer; B1: BOOL): BOOL; stdcall;
var
Sa, Sb: String;
begin
RESULT := FALSE;
Sa := s1; //if you prefer to work with strings internally, simply assign S1 and S2 to strings
Sb := s2; //if not, continue with S1, S2
{...}
IF (..) THEN
RESULT := TRUE;
end;
exports
myfunction;
begin
end.
What are the valid range of values for I1?
You may want to change it to:
BYTE: 0 to 255
WORD: 0 to 65535
LONGINT/INTEGER: -2,147,483,648 to 2,147,483,647
INT64: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
You can try to use the native Delphi Boolean instead of BOOL, but you may have problems using the function from other languages, like C# as you mentioned.
The main problem with dll's created with delphi is passing strings to or from a dll. Since you are passing in two strings, notice the function is expecting two PChars.
As far as how you call it from C#, maybe someone else can assist there.