Can my dll be used in another programming language lazarus / 67-Windows ---------------------------------------------------------------------- vkhoa · 2015-06-18 06:54 I wrote a library like this Code: [Select]library library_delegate; uses Classes, SysUtils; type commandevent=procedure (text:string); var ocommand:commandevent; procedure create(cmd:commandevent);stdcall; begin   ocommand:=cmd; end; procedure writetext(text:string);stdcall; begin   if assigned(ocommand) then      ocommand(text); end; exports create,writetext; begin end.then compiled it to "library_delegate.dll" after that I wrote a program Code: [Select]program use_library_delegate; uses Classes, SysUtils; type commandevent=procedure (text:string); procedure create(cmd:commandevent);stdcall;external 'library_delegate'; procedure writetext(text:string);stdcall;external 'library_delegate'; procedure writeatext(text:string); begin   writeln(text); end; var i:integer; begin   create(@writeatext);   for i:=1 to 100 do       writetext('Text line '+inttostr(i));   readln; end.the program run as I expected, it wrote 100 text line to the console I want to know if this dll could be used in visual basic or C(or other windows programming language). And I am curious to know how simple it is to use the dll's function in those language (especially at passing the procedure type parameter in the "create" procedure), can you give me any examples. another question, can we assign or read the "ocommand" directly from the program? ---------------------------------------------------------------------- taazz · 2015-06-18 07:02 Quote from: vkhoa on June 18, 2015, 08:54:28 amI want to know if this dll could be used in visual basic or C(or other windows programming language). No it can't. You have to stop using the string data type if you want to be compatible. In short you can only use C compatible data types ee Char, pchar etc. ---------------------------------------------------------------------- vkhoa · 2015-06-18 07:20 :)Thanks for the reply! Is visual basic compatible data types is the same as  C compatible data types ? And can we declare and pass the procedure type parameter in those language and assume that I use the right data type, can it call successfully the procedure which was passed to "create" procedure when "writetext"  is called Can anyone tell me detail about the C an VB compatible data types, for example for byte, longint, ect... ---------------------------------------------------------------------- taazz · 2015-06-18 07:37 As far as I know yes Visual basic has the ability to pass a procedure/function address to your code. Make sure that you include the calling convention on your requirements and you are set.