Ну не так нужно делать!
Во-первых, нужно объявить нормально функции в секции exports:
Код:
exports
ShowMessage name 'ShowMessage',
Summ name 'ShowMessage';
Во-вторых, правильное объявление должно быть:
Код:
type
TSumm = function (x: integer; y: integer ): integer;stdcall;
TShowMgs = procedure (text: string);stdcall; // Как в библиотеке объявлено так должно быть объявлено и в программе!!!
В-третьих правильный вызов:
Код:
procedure TForm1.Button2Click(Sender: TObject);
var
dllHandle: THandle;
Sum: TSumm;
begin
@Sum := nil;
dllHandle := LoadLibrary(PChar('FunDll.dll'));
if dllHandle < 32 then // Ошибок загрузки DLL 32 штуки!!
exit;
@Sum := GetProcAddress(dllHandle, PChar('Summ'));
if @Summ = nil then
exit;
showmessage(inttostr(sum(4, 6)));
FreeLibrary(dllHandle);
end;