Following a very simple dll project I'm trying to do. It needs to work
with non-fcp/pascal/delphi applications (like vb, vdf, c, etc.) under
Windows. I would like to know if the following implementation is good
and if there are any errors or potential errors. (The problem is that
I'm unable from another software to load the dll and the function...)

Thank you for any help. (BTW, this example could be put on lazarus
wiki as an example of DLL if this is working. I've wasted so many
hours to get a working example, ... if this one works, I want to share
it with the community.)


library mydll;

{$mode objfpc}{$H+}

uses
  md5;

{ Summary:
    Create a MD5 hash from a string and return the result.
  Author:
    Alexandre Leclerc }

function MakeMD5Hash(aValue: pchar): pchar; stdcall;
var
  s: string;
  size: Integer;
begin
  s := MD5Print(MD5String(aValue));
  size := Length(s) + 1;

  Result := nil;
  GetMem(Result,size);
//  Result := StrAlloc(size); //Use strings;

  Move(Pointer(s)^, Result^, size);
end;

exports
  MakeMD5Hash;

end.


--
Alexandre Leclerc

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to