Problem z biblioteką DLL

0

Mam bibliotekę DLL :

library Przyklad;

uses
  SysUtils,
  Classes,
  WinSock;

{$R *.res}

function IP(text:pansichar):pansichar;
type pu_long = ^u_long;
var WSAData : TWSAData;
HostEnt : PHostEnt;
InAddr : TInAddr;
begin
If WSAStartup($101, WSAData)<>0 Then
Result := pchar('Niemogę pobrać IP z tego hosta')
else begin
HostEnt:=GetHostByName(pchar(Text));
InAddr.S_addr:=u_long(pu_long(HostEnt^.h_addr_list^)^);
Result := pchar(inet_ntoa(InAddr));
End;
WSACleanup;
end;

function BOT(text : string):pansichar;
begin
result:=ip(pchar(text));
end;

exports
  IP name 'IP',
  BOT name 'BOT';
  begin
end.

I jak z niej wywołuję funkcję BOT to z 2 sekundy jak by się przywiesił i się pokazuje błąd

user image

0

O ile wiem nie zaleca się używanie typu String w parametrach funkcji.

0

a to widział jak bibliotekę tworzył

{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's
(select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results
. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }

a o stdcall słyszał??

wyapadało by najpierw coś poczytać o tym co się chce robić...

1 użytkowników online, w tym zalogowanych: 0, gości: 1