Siegfried Jess
2006-01-18 06:58:54 UTC
Hallo,
als Gelegenheitsprogrammierer habe ich wieder mal ein Problem mit
dynamischen Arrays.
Ich binde eigene mit Delphi erzeugte DLL's dynamisch wie folgt in mein
Programm ein:
type
TSplProc = procedure
npspl(const n : integer; const y : array of double;
const d : double; const w : double;
var z : array of double); stdcall; // Delphi DLL
bzw. cdecl; // C++ DLL
procedure npspl (const n : integer; const y : array of double;
const d : double; const w : double;
var z : array of double);
var
Spl : TSplProc;
Handle : THandle;
begin
Handle:=LoadLibrary(PChar('spl.dll'));
if Handle<>0 then begin
@Spl:=GetProcAddress(Handle,'_npspl');
if @Spl<>nil then Spl(n,y,d,w,z);
FreeLibrary(Handle);
end;
end;
Mit Delphi-DLL's funktioniert das alles wunderbar, will ich aber eine
C++ DLL einbinden dann knallts zur Laufzeit.
Verwende ich statische Arrays, so funktionierts auch.
Was mache ich falsch bzw. wie muss ich es richtig machen ?
Oder geht das Ganze gar nicht mit dynamischen Arrays ?
Die C++ Prozedur hat folgenden Kopf:
void
npspl(unsigned long n, double y[], double d, double w, double z[])
Wäre schön wenn mir jemand helfen könnte.
Tschüß
Siggi
als Gelegenheitsprogrammierer habe ich wieder mal ein Problem mit
dynamischen Arrays.
Ich binde eigene mit Delphi erzeugte DLL's dynamisch wie folgt in mein
Programm ein:
type
TSplProc = procedure
npspl(const n : integer; const y : array of double;
const d : double; const w : double;
var z : array of double); stdcall; // Delphi DLL
bzw. cdecl; // C++ DLL
procedure npspl (const n : integer; const y : array of double;
const d : double; const w : double;
var z : array of double);
var
Spl : TSplProc;
Handle : THandle;
begin
Handle:=LoadLibrary(PChar('spl.dll'));
if Handle<>0 then begin
@Spl:=GetProcAddress(Handle,'_npspl');
if @Spl<>nil then Spl(n,y,d,w,z);
FreeLibrary(Handle);
end;
end;
Mit Delphi-DLL's funktioniert das alles wunderbar, will ich aber eine
C++ DLL einbinden dann knallts zur Laufzeit.
Verwende ich statische Arrays, so funktionierts auch.
Was mache ich falsch bzw. wie muss ich es richtig machen ?
Oder geht das Ganze gar nicht mit dynamischen Arrays ?
Die C++ Prozedur hat folgenden Kopf:
void
npspl(unsigned long n, double y[], double d, double w, double z[])
Wäre schön wenn mir jemand helfen könnte.
Tschüß
Siggi