Cześć!
Na wstępie przepraszam jeśli powinno trafić do Newbie ale wydaje mi się że nie będę pytał o takie podstawy.
Mija chyba z 9 lat jak przestałem programować w Delphi - zająłem się web'em i grafiką.
Teraz pojawiła się potrzeba wykorzystania pewnej biblioteki (chce postawić bardzo prosty serwer zwracający JSONa na podstawie tego co zwróci dll'ka).
Biblioteka to "Morfeusz": http://sgjp.pl/morfeusz/
Na windows jest dostępny do pobrania skompilowany program wraz z dllką.
Mam od tego taki kod źródłowy:
struct _InterpMorf {
int p, k; /* number of start node and end node */
char *forma, /* segment (token) */
*haslo, /* lemma */
*interp; /* morphosyntactic tag */
};
typedef struct _InterpMorf InterpMorf;
[...]
/* Analyse a piece of text:
'tekst' - the string to be analysed. [...]
RETURNS a table of InterpMorf structures representing edges of
the resulting graph.
*/
DLLIMPORT InterpMorf *morfeusz_analyse(char *tekst);
Teraz pytanie: czy mogę tę dllkę wykorzystać w programie pisanym w Lazarusie?
Zakładam że się dla, dlatego próbowałem coś rzeźbić ale kiepsko mi idzie...:
type
InterpMorf = record
p : integer;
k : integer;
forma : PChar;
haslo : PChar;
interp : PChar;
end;
type TLIST = array of InterpMorf;
type TLISTPtr = ^TLIST;
{...}
var h: Thandle;
morfeusz_analyse: function(tekst: PChar) : TLISTPtr;
r: TLISTPtr;
begin
h := LoadLibrary('morfeusz2.dll');
if h >= 32 then
begin
Pointer(morfeusz_analyse) := GetProcAddress(h, 'morfeusz_analyse');
r := morfeusz_analyse('Ten łańcuch jest testem a Ala będzie miała kota');
showmessage( inttostr(length(r^) ));
FreeLibrary(h);
end
else
MessageDlg('Error: could not find BAR.DLL', mtError, [mbOk], 0);
end;
number of start node and end node