Einzelnen Beitrag anzeigen

diso

Registriert seit: 21. Sep 2007
6 Beiträge
 
#4

AW: DLL einbinden Delphi7 vs Rad Studio 10.2

  Alt 9. Jun 2018, 03:58
Sorry habe das bin Link geposted.. Sources: http://ngspice.sourceforge.net/ngspi..._src_delphi.7z

oder :
Code:
  ngspice_Init: function(ptrchar: Pointer; ptrstat: Pointer; ptrexit: Pointer;
                ptrdata: Pointer; ptrinitdata: Pointer; ptrnoruns: Pointer; userData: Pointer): integer; cdecl;
  ngspice_Com: function(ms: PChar): Integer; cdecl;
  ngspice_GetVec: function(ms: PChar): pVector_info; cdecl;
  ngspice_SendCirc: function(circarray: pcarray): Integer; cdecl;
  ngspice_GetCurPlot: function(): PChar; cdecl;
  ngspice_GetPlotNames: function(): ppansichararray; cdecl;
  ngspice_GetVecsFromPlot: function(plotname: PChar): ppansichararray; cdecl;
  ngspice_Running: function(): boolean; cdecl;
  ngspice_Init_Sync: function(ptrvsrcval: Pointer; ptrisrcval: Pointer; ptrsync: Pointer; ident: PInteger; userData: Pointer): integer; cdecl;
  ngspice_SetBkpt: function(simtime: double): boolean; cdecl;




// attach ngspice.dll and initialize ngspice
procedure TForm1.Button1Click(Sender: TObject);
var
   init_test: integer;
   ng_ident: integer;

begin
   // load dll
   Hdll := LoadLibrary(PChar(StartIni.ReadString('ngspice.dll', 'Path', '')));
   if (Hdll = 0) then
      // try local directory
      Hdll := LoadLibrary('ngspice.dll');
   if (Hdll <> 0) then
   begin
      @ngspice_Init := GetProcAddress(Hdll, 'ngSpice_Init');
      @ngspice_Com := GetProcAddress(Hdll, 'ngSpice_Command');
      @ngspice_GetVec := GetProcAddress(Hdll, 'ngGet_Vec_Info');
      @ngspice_SendCirc := GetProcAddress(Hdll, 'ngSpice_Circ');
      @ngspice_GetCurPlot := GetProcAddress(Hdll, 'ngSpice_CurPlot');
      @ngspice_GetPlotNames := GetProcAddress(Hdll, 'ngSpice_AllPlots');
      @ngspice_GetVecsFromPlot := GetProcAddress(Hdll, 'ngSpice_AllVecs');
      @ngspice_Running := GetProcAddress(Hdll, 'ngSpice_running');
      @ngspice_Init_Sync := GetProcAddress(Hdll, 'ngSpice_Init_Sync');
      @ngspice_SetBkpt := GetProcAddress(Hdll, 'ngSpice_SetBkpt');
      // call initialization
      // send addresses of callback functions, and address of sending object
      init_test := ngspice_Init(@ng_getchar, @ng_getstat, @ng_exit, @ng_data,
                                @ng_initdata, @ng_thread_runs, self);
//       init_test := ngspice_Init(@ng_getchar, nil, @ng_exit, @ng_data,
//                                @ng_initdata, @ng_thread_runs, self);
      if (init_test = 1) then
      begin
        detach(coquit);
      end;
      ng_ident := 5;
      init_test := ngspice_Init_Sync(@ng_sendvsrc, @ng_sendisrc,
                                     @ng_sync {nil} , @ng_ident, self);
      if (init_test = 1) then
      begin
        detach(coquit);
        is_attached := false;
      end;
      will_detach := False;
      is_attached := True;
   end
   else
   begin
     MessageDlg('ngspice.dll not found', mtError, [mbAbort], 0);
     Form1.Close;
   end;
end;
  Mit Zitat antworten Zitat