application could not be started correctly (0xc000007) lazarus / 64-FPC development ---------------------------------------------------------------------- Weitentaaal · 2020-10-27 15:53 Hey Guys, So in my Project im Getting this Error Message(Caption of Topic) when after kompiling. The kompiling was Succsessfull. I think its because of my sqlite.dll. I Have no clue about 64 Bit dll's and 32 Bit dll's and where they are installed or just how to fix this error. Thanks for Help ---------------------------------------------------------------------- Weitentaaal · 2020-10-27 15:55 Version 2.0.6 FPC version 3.0.4 x86_64-win64-win32/win64 ---------------------------------------------------------------------- 440bx · 2020-10-27 18:58 error 0xC000 0007 (STATUS_PAGEFILE_QUOTA) is reported by Windows usually when it encounters a problem related to page file usage.  Most common problem is to run out of space in the page file.  This could be a result of using a fixed page file size or an extensible page file on a drive that has run out of space.  Those are not the only two reasons, other reasons related to the page file are possible. your first step should be to check your page file usage and accessibility. HTH. ---------------------------------------------------------------------- Weitentaaal · 2020-10-28 12:54 So i wrote a little Test Programm just to see if it works with my external dll. Error was no more but it was very weird Code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,  sqldb,  SQLite3Conn, DB; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  private   public   end; var  Form1: TForm1;   Procedure dbExecute(var Recordset: TSQLQuery; Query: String); external 'networkdb.dll';  Procedure initNetworkDB(MacAdresse, pathToWGR: String; ZeichnungsNr: Integer; DATABASE_MODE: Integer = 2);external 'networkdb.dll'; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);var  dbT: TSQLQuery;begin  ShowMessage('Before dll');  initNetworkDB('rand','C:\WGKBlck\Data\', 1, 2);  ShowMessage('t1');  dbT := TSQLQuery.Create(nil);  showMessage('t2');  showMessage('t3');  dbExecute(dbT ,'SELECT * FROM Plattentauscher');  ShowMessage('t4');   ShowMessage(dbT.FieldByName('INDEX').Text);   dbT.Free;end;end.  it just came until ShowMessage('t3'); and after that came nothing anymore... not even an error and there are no endless code blocks Dll Code : Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i library NetworkDB; {$mode objfpc}{$H+} uses  SysUtils, StrUtils, odbcconn, WinINet, Math, SQLite3Conn, Classes, sqldb, db, Dialogs; type  BBWeb = record      S01, S02, S03, S04, S05, S06, S07, S08, S09, S10, S11, S12, S13, S14, S15, S16, S17, S18, S19, S20, S21, S22, S23, S24, S25: String;      S26, S27, S28, S29, S30, S31, S32, S33, S34, S35, S36, S37, S38, S39, S40, S41, S42, S43, S44, S45, S46, S47, S48, S49, S50: String;      R01, R02, R03, R04, R05, R06, R07, R08, R09, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25: String;      R26, R27, R28, R29, R30, R31, R32, R33, R34, R35, R36, R37, R38, R39, R40, R41, R42, R43, R44, R45, R46, R47, R48, R49, R50: String;      RML: String;  end;   LicenseVar = record    Is3d, Sound, Regis, SysView, EnabMod, TimStamp, ShFact, AlowModfy, PrxStat, PrxCop, SecNumber1, SecNumber2, OwnPick: Integer;    MacAd, Cntry, Firma, FUser, SVers, BBSrvIP1, BBSrvIP2: String;    MFak, SteuFak: Single;  OpenDim: Boolean;  End;   IpVar = record    Byt1, Byt2, Byt3, Byt4: Integer;  End; var  MAC, WGRPath: String;  DB_MODE, ZeichNr: Integer;  mdbConn, mdbWGR: TSQLite3Connection;  sqlConnWGR, sqlConnWSET, sqlConnDEF: TSQLite3Connection;  SQLTransWGR, SQLTransWSET, SQLTransDEF: TSQLTransaction; const  { ----- constants ----- }  BBWebAdresse = 'http://80.247.70.137/'; //oder 'http://80.247.70.136/'  LicUrl = 'http://wgk.weger.it';   MDBPath = 'C:\WGKBlck\Data\wegerset.mdb';  MDBPass = '260599';   WGRPass = 'wgkadmin';   SQLiteWGRPath = 'C:\WGKBlck\Data\Noname.db';  SQLiteWGRPass = 'wgkadmin';   SQLiteWSETPath = 'C:\WGKBlck\Data\wegerset.db';  SQLiteWSETPass = '260599';   SQLiteDEFPath = 'C:\WGKBlck\Data\Definitionen.db'; { ----- initialisation ----- }Procedure initdb(MODE: Integer);Begin //Datenbank initialisieren  DB_MODE := MODE;  Case DB_MODE Of //Verbindungstyp wählen (MSAccess oder SQLite)    1:      Begin      {mdbConn := TODBCConnection.Create(Nil);        mdbConn.Driver := 'Microsoft Access Driver (*.mdb)';        mdbConn.Params.add('DBQ=' + MDBPath);        mdbConn.Params.add('pwd=' + MDBPass);        mdbConn.Connected := true;        mdbConn.KeepConnection := true;      TSQLTransaction.Create(Nil).DataBase := mdbConn;         mdbWGR := TODBCConnection.Create(Nil);        mdbWGR.Driver := 'Microsoft Access Driver (*.mdb)';        mdbWGR.Params.add('DBQ=' + WGRPath);        mdbWGR.Params.add('pwd=' + WGRPass);        mdbWGR.Connected := true;        mdbWGR.KeepConnection := true;        TSQLTransaction.Create(Nil).Database := mdbWGR;}      End;    2:      Begin        Try           Applicatio.i;           { ----- WGR Connect ----- }           sqlConnWGR := TSQLite3Connection.Create(Nil);         sqlConnWGR.DatabaseName := SQLiteWGRPath;           //sqlConnWGR.HostName := SQLiteDBHost;           //sqlConnWGR.UserName := SQLiteDBUser;           sqlConnWGR.Password := SQLiteWGRPass;           sqlConnWGR.Connected := true;           sqlConnWGR.KeepConnection := true;            SQLTransWGR := TSQLTransaction.Create(sqlConnWGR);           sqlConnWGR.Transaction := SQLTransWGR;            { ----- WSET Connect ----- }           sqlConnWSET := TSQLite3Connection.Create(Nil);           sqlConnWSET.DatabaseName := SQLiteWSETPath;           //sqlConnWSET.HostName := SQLiteDBHost;           //sqlConnWSET.UserName := SQLiteDBUser;           sqlConnWSET.Password := SQLiteWSETPass;           sqlConnWSET.Connected := true;           sqlConnWSET.KeepConnection := true;            SQLTransWSET := TSQLTransaction.Create(sqlConnWSET);           sqlConnWSET.Transaction := SQLTransWSET;            { ----- DEF Connect ----- }           sqlConnDEF := TSQLite3Connection.Create(Nil);           sqlConnDEF.DatabaseName := SQLiteDEFPath;           //sqlConnDEF.HostName := SQLiteDBHost;           //sqlConnDEF.UserName := SQLiteDBUser;           //sqlConnDEF.Password := SQLiteWSETPass;           sqlConnDEF.Connected := true;           sqlConnDEF.KeepConnection := true;            SQLTransDEF := TSQLTransaction.Create(sqlConnDEF);         sqlConnDEF.Transaction := SQLTransDEF;           except            //on e:exception do //TODO           end;      End;    Else Exit();  End;End; Procedure initNetworkDB(MacAdresse, pathToWGR: String; ZeichnungsNr: Integer; DATABASE_MODE: Integer = 2);Begin  ShowMessage('initNetworkDb()');  MAC := MacAdresse;  ZeichNr := ZeichnungsNr;  WGRPath := pathToWGR;  initdb(DATABASE_MODE);End; Procedure exitNetworkDB();Begin  Case DB_MODE Of    1:      begin        mdbConn.Close();        mdbconn.CloseDataSets;        mdbWGR.Close();        mdbWGR.CloseDataSets;      end;    2: begin       sqlConnDEF.Close();       sqlConnWGR.Close();       sqlConnWSET.Close();       SQLTransDEF.CloseDataSets;       SQLTransWGR.CloseDataSets;       SQLTransWSET.CloseDataSets;    end;  End;End; { ----- implementation ---- }Procedure dbExecute(var Recordset: TSQLQuery; Query: String); //TSQLQuery entspricht VB6 Recordset (fast)Begin  Recordset.Free;  Recordset := TSQLQuery.Create(nil);  Case DB_MODE Of    1: Recordset.DataBase := mdbConn;    2: Recordset.DataBase := sqlConnWSET;  End;  Recordset.UsePrimaryKeyAsKey := False;  Recordset.PacketRecords := -1;  Recordset.SQL.Text := Query;  Recordset.Open;End; Procedure wgrExecute(var Recordset: TSQLQuery; Query: String);Begin  Recordset.Free;  Recordset := TSQLQuery.Create(nil);  Recordset.UsePrimaryKeyAsKey := False;  Case DB_MODE Of     1: Recordset.DataBase := mdbWGR;     2: Recordset.DataBase := sqlConnWGR;  End;  Recordset.PacketRecords := -1;  Recordset.SQL.Text := Query;  Recordset.Open;End; Procedure defExecute(var Recordset: TSQLQuery; Query: String);Begin  Recordset.Free;  Recordset := TSQLQuery.Create(nil);  Recordset.UsePrimaryKeyAsKey := False;  Case DB_MODE Of     //1: //Recordset.DataBase := mdbWGR;     2: Recordset.DataBase := sqlConnDEF;  End;  Recordset.PacketRecords := -1;  Recordset.SQL.Text := Query;  Recordset.Open;End; procedure EditField(ToEditField, Tabelle, ToEdit, DATA : String);var   SQLQuery : TSQLQuery;begin   SQLQuery := TSQLQuery.Create(Nil);   SQLQuery.DataBase := sqlConnWGR;    SQLQuery.FieldByName('SELECT * FROM ' +Tabelle+ ' WHERE DATA = ' +DATA+ ';');   SQLQuery.Edit();   SQLQuery.FieldByName(ToEditField).NewValue := ToEdit;   SQLQuery.Post();   SQLQuery.Upda]"]>Blockedde :=  upWhereAll;   SQLQuery.ApplyUpdates();   SQLQuery.Closeend; exports  EditField,  initNetworkDB,  initdb,  exitNetworkDB,  dbExecute,  wgrExecute,  defExecute;end.   it came until ---------------------------------------------------------------------- 440bx · 2020-10-28 13:23 I suggest you do this: 1. Reboot your computer 2. Immediately run the program that is giving you problems The question is: does the program run successfully or not immediately after a reboot ? If successful then it is quite likely the problem is caused by something external to the program (such as page file usage), if not then the cause of the problem is likely due to something in the code. HTH. ---------------------------------------------------------------------- Weitentaaal · 2020-10-28 13:29 Still the same it runs the initNetworkDb Method in my external dll and after that i runs until dbExecute, where the Programm just stops without a Message or Error ---------------------------------------------------------------------- 440bx · 2020-10-28 15:06 If I interpreted your reply correctly, that means your program loads and executes.  This would indicate there is no longer a page file related problem. The description you provided of the problem indicates it is caused by something "not quite right" in your code. My knowledge of the LCL is much too limited to be of further help but, I suggest you run your test program under the debugger and inspect the results at each statement until you find the point/statement where the result/data is no longer as you expect it. That can hopefully provide enough information to someone more knowledgeable about the LCL to suggest an appropriate course of action. ---------------------------------------------------------------------- Weitentaaal · 2020-10-28 15:46 Yea i already Tryed it but as u can see in my Unit1 (Test Code) there is the Method dbExecute called. If i go over it with the Debugger it stops at this Line and i can't go any further. At this Point there is nothing that happens anymore. It's like u would just Execute the Programm until this point and then stop it and close it without saying anything. Is there any Mistake i made by using external dll's ? because it must be a problem with the dll i think (second codeblock posted above) ---------------------------------------------------------------------- rvk · 2020-10-28 16:19 Yikes... Freeing TSQLQuery inside a dll? Passing a string in a dll-call? Are you sure they (main program and dll) are using the same shared memorymanager? (I don't see anything like that in the source) Without it, passing TSQLQuery and strings can be problematic (I thought). ---------------------------------------------------------------------- Weitentaaal · 2020-10-29 06:39 How can i see the shared memory manager ? i think i just will rewrite this mess, thank u guys for ur help ---------------------------------------------------------------------- PascalDragon · 2020-10-29 08:12 Quote from: Weitentaaal on October 28, 2020, 01:54:08 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,  sqldb,  SQLite3Conn, DB; type   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    procedure Button1Click(Sender: TObject);  private   public   end; var  Form1: TForm1;   Procedure dbExecute(var Recordset: TSQLQuery; Query: String); external 'networkdb.dll';  Procedure initNetworkDB(MacAdresse, pathToWGR: String; ZeichnungsNr: Integer; DATABASE_MODE: Integer = 2);external 'networkdb.dll'; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);var  dbT: TSQLQuery;begin  ShowMessage('Before dll');  initNetworkDB('rand','C:\WGKBlck\Data\', 1, 2);  ShowMessage('t1');  dbT := TSQLQuery.Create(nil);  showMessage('t2');  showMessage('t3');  dbExecute(dbT ,'SELECT * FROM Plattentauscher');  ShowMessage('t4');   ShowMessage(dbT.FieldByName('INDEX').Text);   dbT.Free;end;end.  Do not pass class instances as such across binary boundaries. This is an accident waiting to happen. You need to handle this with opaque types (and rvk is right about strings as well, though those could be solved with a shared memory manager). For example: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type  TDllQuery = Pointer;  TDllField = Pointer;   Procedure dbExecute(Recordset: TDllQuery; Query: String); external 'networkdb.dll';  Procedure initNetworkDB(MacAdresse, pathToWGR: PChar; ZeichnungsNr: Integer; DATABASE_MODE: Integer = 2);external 'networkdb.dll';  function CreateQuery: TDllQuery; external 'networkdb.dll';  procedure FreeQuery(aQuery: TDllQuery); external 'networkdb.dll';  function QueryFieldByName(aQuery: TDllQuery; aField: PChar): TDllField; external 'networkdb.dll';  function FieldText(aField: TDllField): PChar; exteranl 'networkdb.dll';  In your library  you can simply return the class instance of the TSQLQuery or the TField, but you must not access it as such outside of your library. Essentially you need to flatten your API if you want to use it like that. Such problems will only be solved once the compiler and RTL fully support dynamic packages. ---------------------------------------------------------------------- Weitentaaal · 2020-11-02 11:56 Thank u I know what my mistakes are now