Witam, oto co chcę zrobić na test:
plik dll pisany w c++:
#include <stdio.h>
struct __declspec(novtable) ITest
{
virtual void Print() = 0;
virtual void Release() = 0;
};
struct cTest: public ITest
{
void Print() {printf("cTest::Print()");};
void Release() {delete this;};
};
typedef ITest* LPTEST;
__declspec(dllexport) void CreateTest(LPTEST* test)
{
*test = new cTest;
};
użycie pliku dll w Delphi:
type
ITest = interface
procedure Print; cdecl;
procedure Release; cdecl;
end;
LPTEST = ^ITest;
LPPTEST = ^LPTEST;
procedure CreateTest(test: LPPTEST); cdecl external 'Test.dll' index 1;
var
t: LPTEST;
begin
CreateTest(@t);
t^.Print; // tu wywala jakiś błąd podczas działania programu
t^.Release;
end.
Nioe wiem dlaczego to niedziała, może wy pomożecie.