Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
2015-06-24 19:02 GMT-03:00 Bo Berglund bo.bergl...@gmail.com: In order to port it we had to convert an OBJ file from the dongle maker to a format FPC accepts (coff) using a 3rd party tool, which also has some bug in it. There's a tool called CVTRES.EXE that comes with Visual Studio that does such conversion. It's an alternative to get a proper coff format Luiz -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
El 25/06/2015 a las 21:03, Bo Berglund escribió: There's a tool called CVTRES.EXE that comes with Visual Studio that does such conversion. It's an alternative to get a proper coff format I do have VS installed so I have this tool: D:\cvtres Hello, I think the tool is Editbin, cvtres is to convert resources: cvtres = ConVerT RESource Also the linker should do it (OMF to COFF): link -edit thefile.obj -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Thu, 25 Jun 2015 07:28:51 -0300, luiz americo pereira camara luiz...@oi.com.br wrote: 2015-06-24 19:02 GMT-03:00 Bo Berglund bo.bergl...@gmail.com: In order to port it we had to convert an OBJ file from the dongle maker to a format FPC accepts (coff) using a 3rd party tool, which also has some bug in it. There's a tool called CVTRES.EXE that comes with Visual Studio that does such conversion. It's an alternative to get a proper coff format I do have VS installed so I have this tool: D:\cvtres Microsoft (R) Windows Resource To Object Converter Version 7.10.3052.4 Copyright (C) Microsoft Corporation. All rights reserved. usage: CVTRES [options] [files] options: /DEFINE:symbol /MACHINE:{AM33|ARM|CEF|IA64|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16| MIPSR41XX|PPC|PPCFP|SH3|SH3DSP|SH4|SH5|THUMB|X86} /NOLOGO /OUT:filename /READONLY /VERBOSE /WINDOWSCE[:{CONVERT|EMULATION}] Nevet used it though. When I tried to google it to find a manual or such there were almost nothing but how to get rid of the cvtres virus... Is there a howto or user's manual for this tool? Specifically I need to verify that it can do OBJ = COFF -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
El 19/06/2015 a las 9:38, Luca Olivetti escribió: El 19/06/15 a les 09:25, Bo Berglund ha escrit: constructor TSentinel.Create; begin FTimer := TTimer.Create(Application); FTimer.Enabled := false; FTimer.Interval := 0; FTimer.OnTimer := OnCheckTimer(Self); //= Error here ... Why is this difference Delphi/FPC appearing and what can I do? Either you use {$MODE DELPHI} or you prepend the method with @, i.e. FTimer.OnTimer := @OnCheckTimer I think that Luca's code doesn't work on delphi either. He should write FTimer.OnTimer := OnCheckTimer; Without the self parameter self. If you add the parameter self, delphi would think you call method function called OnChecktimer. As OnCheckTimer is a procedure, not a function, rises error. If OnTimer wouldn't had parameters, there could a confusion, that IMHO FPC with @ solves in an elegant way. With a parameter there is no ambiguity, that's an error: Assigning to variable the result of procedure. -- Santiago A. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 23/06/15 23:06, luiz americo pereira camara wrote: Take a look at https://msdn.microsoft.com/pl-pl/library/vstudio/7dz62kfh(v=vs.110).aspx https://msdn.microsoft.com/pl-pl/library/vstudio/7dz62kfh%28v=vs.110%29.aspx (it suggests a cvtres.exe tool) Ask to fpc guru if is possible to use manually an different linker like http://www.digitalmars.com/ctg/optlink.html In the end, i would try to compile a delphi dll and access it in fpc. Another try (don't know if is possible) is to use delphi to compile spromeps.pas as a obj in COFF I have discovered potential bugs in the 3rd party tool objconv.exe that converts from omf to coff, and most importantly in fpc's internal linker. I provided Bo Berglund with a workaround for objconv that seems to work, and advised him to use the external linker (-Xe switch). The exception has vanished and basic tests have succeeded. I will file a bug report against fpc's internal linker soon. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 23/06/15 23:06, luiz americo pereira camara wrote: Take a look at https://msdn.microsoft.com/pl-pl/library/vstudio/7dz62kfh(v=vs.110).aspx https://msdn.microsoft.com/pl-pl/library/vstudio/7dz62kfh%28v=vs.110%29.aspx (it suggests a cvtres.exe tool) Ask to fpc guru if is possible to use manually an different linker like http://www.digitalmars.com/ctg/optlink.html In the end, i would try to compile a delphi dll and access it in fpc. Another try (don't know if is possible) is to use delphi to compile spromeps.pas as a obj in COFF I have discovered potential bugs in the 3rd party tool objconv.exe that converts from omf to coff, and most importantly in fpc's internal linker. I provided Bo Berglund with a workaround for objconv that seems to work, and advised him to use the external linker (-Xe switch). The exception has vanished and basic tests have succeeded. I will file a bug report against fpc's internal linker soon. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
ALMOST SOLVED (workaround found) As patspiper has posted there has been a potential bug discovered in the fpc linker while tracing my problems with porting the Sentinel SuperPro dongle handler class from Delphi to Lazarus/FPC. In order to port it we had to convert an OBJ file from the dongle maker to a format FPC accepts (coff) using a 3rd party tool, which also has some bug in it. Patspiper will handle the bug reports. The solution to the actual problem for me was: 1) Convert the OBJ file to COFF and alias the internal identifiers such that FPC can find them. This uses the 3rd party tool objconv. Then replace the include directive for the OBJ file with the COFF file. 2)Use the compiler switch -Xe in order to link externally. Much slower but results in a working application. Many thanks to patspiper who has spent a lot of time helping me to track down the cause of the problems! -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Tue, 23 Jun 2015 12:07:05 +, Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: Bo Berglund wrote: On Mon, 22 Jun 2015 16:43:31 -0300, luiz americo pereira camara luiz...@oi.com.br wrote: In the breakpoint do a step into (f7) and ser the exact line that crashes Luiz In the pas unit this is the exact line that crashes: returnVal := RNBOsproFormatPacket (ApiPacket, RB_SPRO_APIPACKET_SIZE); This is the first call into the drive via the converted obj file. Must be something in error in the conversion. Or in the declaration of the parameter types. Note that what I am trying to accomplish is porting an application from Delphi to Lazarus where the dongle handling is by way of an interface unit (spromeps.pas) and an include file (spromeps.obj) where the implementation of the API into the SuperPro driver is done. In Delphi the obj file is used as follows: implementation {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } It has worked just fine since roundabout 2002 in all the Delphi versions we have used including XE5. The spromeps.pas file declares all the needed functions which we need to use in the driver and calls them as externals via the obj file. Unfortunately Lazarus/FPC does not handle the obj file so this thread is really about ways to get around that by converting the obj file to coff (or elf) that FPC can handle. I got tipped off about a tool thta can do this and downloaded objconf from here: http://www.agner.org/optimize/#objconv The problem is most likely in the conversion because even the smallest test application throws an exception on the very first call into the driver, the initialization of the Api data interface array. The function call shown above is the last in a chain starting in the main application by the method Dongle.InitKey. Everything up to this call seems OK on inspection but the actual call to the driver via the converted obj file (now a coff file) fails. Since the obj file works in Delphi with such disparate versions as Delphi 5 up to Delphi XE5 it cannot be a compiler incompatibility problem, really. It MUST be the conversion using objconv, which is somehow improperly set up for the task. But it is hard to understand how to set it up since I have no experience in such low-level programming in Windows. This is where I am now: No matter what I try there are exceptions generated... :( It would have been nice if FPC could accept linking with a regular OBJ file so I did not have to convert it. -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
El 23/06/15 a les 17:51, Bo Berglund ha escrit: The problem is most likely in the conversion because even the smallest test application throws an exception on the very first call into the driver, the initialization of the Api data interface array. Or in the calling convention http://freepascal.org/docs-html/prog/progse22.html#x174-1770006.3 you can try and define the external as stdcall or if that fail try cdecl (though I'm not sure the default is different than delphi). Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Tue, 23 Jun 2015 18:30:46 +0200, Luca Olivetti l...@wetron.es wrote: El 23/06/15 a les 17:51, Bo Berglund ha escrit: The problem is most likely in the conversion because even the smallest test application throws an exception on the very first call into the driver, the initialization of the Api data interface array. Or in the calling convention http://freepascal.org/docs-html/prog/progse22.html#x174-1770006.3 you can try and define the external as stdcall or if that fail try cdecl (though I'm not sure the default is different than delphi). STDCALL has been there forever (since about 2002)... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
El 23/06/15 a les 20:38, Bo Berglund ha escrit: On Tue, 23 Jun 2015 18:30:46 +0200, Luca Olivetti l...@wetron.es wrote: El 23/06/15 a les 17:51, Bo Berglund ha escrit: The problem is most likely in the conversion because even the smallest test application throws an exception on the very first call into the driver, the initialization of the Api data interface array. Or in the calling convention http://freepascal.org/docs-html/prog/progse22.html#x174-1770006.3 you can try and define the external as stdcall or if that fail try cdecl (though I'm not sure the default is different than delphi). STDCALL has been there forever (since about 2002)... You could try cdecl then (though I doubt it will make a difference). Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
Take a look at https://msdn.microsoft.com/pl-pl/library/vstudio/7dz62kfh(v=vs.110).aspx (it suggests a cvtres.exe tool) Ask to fpc guru if is possible to use manually an different linker like http://www.digitalmars.com/ctg/optlink.html In the end, i would try to compile a delphi dll and access it in fpc. Another try (don't know if is possible) is to use delphi to compile spromeps.pas as a obj in COFF Luiz 2015-06-23 15:50 GMT-03:00 Luca Olivetti l...@wetron.es: El 23/06/15 a les 20:38, Bo Berglund ha escrit: On Tue, 23 Jun 2015 18:30:46 +0200, Luca Olivetti l...@wetron.es wrote: El 23/06/15 a les 17:51, Bo Berglund ha escrit: The problem is most likely in the conversion because even the smallest test application throws an exception on the very first call into the driver, the initialization of the Api data interface array. Or in the calling convention http://freepascal.org/docs-html/prog/progse22.html#x174-1770006.3 you can try and define the external as stdcall or if that fail try cdecl (though I'm not sure the default is different than delphi). STDCALL has been there forever (since about 2002)... You could try cdecl then (though I doubt it will make a difference). Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 2015-06-23 16:51, Bo Berglund wrote: No matter what I try there are exceptions generated... :( It would have been nice if FPC could accept linking with a regular OBJ file so I did not have to convert it. You might be better off moving this discussion to the fpc-users mailing list. I believe more FPC and compiler developers lurk there. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
Bo Berglund wrote: On Mon, 22 Jun 2015 16:43:31 -0300, luiz americo pereira camara luiz...@oi.com.br wrote: In the breakpoint do a step into (f7) and ser the exact line that crashes Luiz In the pas unit this is the exact line that crashes: returnVal := RNBOsproFormatPacket (ApiPacket, RB_SPRO_APIPACKET_SIZE); This is the first call into the drive via the converted obj file. Must be something in error in the conversion. Or in the declaration of the parameter types. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 06/23/2015 01:35 PM, patspiper wrote: Pls don't hijack the thread with your never ending NoGui discussions. Sorry. But for somebody coming from Delphi it is likely confusing that a NoGUI application needs to be done completely different than an Application that does have a GUI, so I thought a warning would be appropriate. I did not intend to hijack the thread and come back in an appropriate way later. Sorry again. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 16:43:31 -0300, luiz americo pereira camara luiz...@oi.com.br wrote: In the breakpoint do a step into (f7) and ser the exact line that crashes Luiz In the pas unit this is the exact line that crashes: returnVal := RNBOsproFormatPacket (ApiPacket, RB_SPRO_APIPACKET_SIZE); This is the first call into the drive via the converted obj file. Must be something in error in the conversion. -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 06/23/2015 10:43 AM, Graeme Geldenhuys wrote: File-New Console Application That creates a Console application - thus no dependenies on GUI toolkits. And not support for things like TTimer, Application.QueuAsyncCall, Support for TThread.Queue and TThread.Synchronize needs to be provided by special user code, ... -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 2015-06-22 17:14, Bo Berglund wrote: I tried to do what you proposed: File-New Console Application That creates a Console application - thus no dependenies on GUI toolkits. sentinel.pas(14,3) Fatal: Cannot find unit ExtCtrls used by Sentinel. Check if package LCLBase is in the dependencies. It points to the uses clause in the Sentinel.pas file where standard units are mentioned like Forms, ExtCtrls etc... So that means (so often the case with Delphi components) that sentinel.pas depends on a GUI toolkit. Because you created a console application, such dependencies are not allow. Often (but not always) units like that include Forms, Dialogs, Graphics etc in the uses clause, even though they don't actually use them. For a dongle there shouldn't be any need for a GUI toolkit. Comment out any GUI toolkit units in the sentinel.pas unit and try again. None of these complaints were issued when I used the exact same unit in my GUI test application. So surprise, because your GUI application had a dependency on LCL, thus it could find the Forms, Dialogs etc units. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 06/23/2015 12:51 PM, Graeme Geldenhuys wrote: Not to rehash an old topic... Maybe that is true for TTimer, but it took me all of 10 minutes to implement a multi-threaded console application and implementing a TThread based timer from scratch. All working just fine under FreeBSD. So I really don't see the issue or why you keep harping on this topic. That is obviously correct, but not nice. I do have working code for my long-time-project ActiveNoGUI and I will restart working on that as soon I have some spare time. I was in waiting state until the *released* Lazarus comes with an fpc version that supports TThread.Queue, which is a prerequisite for doing an ActiveNoGUI Widget Type for Lazarus (that also supports Application.QueueAsyncCall). AFAIK this now is given, but I did not yet check (and don't now how I should check it, as comes with is not really defined ). -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Tue, 23 Jun 2015, Graeme Geldenhuys wrote: On 2015-06-23 10:45, Michael Schnell wrote: And not support for things like TTimer Not to rehash an old topic... Maybe that is true for TTimer, but it took me all of 10 minutes to implement a multi-threaded console application and implementing a TThread based timer from scratch. All working just fine under FreeBSD. So I really don't see the issue or why you keep harping on this topic. Ehm. fpTimer contains just that, it exists since years. Before your answer, I thought to reply something similar, but some people are obviously beyond help or reason... Michael. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 06/23/2015 01:26 PM, Michael Van Canneyt wrote: Ehm. fpTimer contains just that, it exists since years. This of course is a well known fact.. But if this is the recommended way to do timers, why does *any *WidgetType (i.e. TApplication) offer TTimer ? -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 23/06/15 14:30, Michael Schnell wrote: On 06/23/2015 01:26 PM, Michael Van Canneyt wrote: Ehm. fpTimer contains just that, it exists since years. This of course is a well known fact.. But if this is the recommended way to do timers, why does *any *WidgetType (i.e. TApplication) offer TTimer ? -Michael Pls don't hijack the thread with your never ending NoGui discussions. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 2015-06-23 10:45, Michael Schnell wrote: And not support for things like TTimer Not to rehash an old topic... Maybe that is true for TTimer, but it took me all of 10 minutes to implement a multi-threaded console application and implementing a TThread based timer from scratch. All working just fine under FreeBSD. So I really don't see the issue or why you keep harping on this topic. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 17:47:15 +0300, patspiper patspi...@gmail.com wrote: On 22/06/15 17:34, Bo Berglund wrote: But your best bet is to install the 32 bit version and try it yourself. That is what I have already... I am out of ideas for now. You can ask for help on the fpc mailing list. I propose you prepare a minimum working example in an lpr file (no units, just a program which outputs to console using writeln) which only initializes the dongle/driver. Thanks, I tried to do what you proposed: File-New Console Application After filling in some name boxes I started adding the very minimal code: { add your program here } Writeln('Starting check program'); Dongle := TSentinel.Create; if not Dongle.InitKey then Writeln('Dongle Init Failed!') else begin Writeln('SerialNo: ' + IntToStr(Dongle.SerialNo)); end; // stop program loop But when I compile I get this error: sentinel.pas(14,3) Fatal: Cannot find unit ExtCtrls used by Sentinel. Check if package LCLBase is in the dependencies. It points to the uses clause in the Sentinel.pas file where standard units are mentioned like Forms, ExtCtrls etc... Before this error it also complained about Forms in the uses clause of the Sentinel.pas file. But then I commented out that in the sentinel.pas file. None of these complaints were issued when I used the exact same unit in my GUI test application. How do I Check if package LCLBase is in the dependencies? And why is it not picking it up? I googled this error and was directed to the following: Project-Project Inspector-Required Packages-Add This opened a file open dialog and I typed in LCLBase but tha did not work... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 13:29:07 -0300, luiz americo pereira camara luiz...@oi.com.br wrote: In my experince sigsegv occurs mostly when a field or variable is accessed before initialization. Try to set a breakpoint in dongle.initkey call. And evaluate the dongle field (open debugger evaluate window) Look for dongle or one of the tsentinel fields being nil I have already a breakpoint in the on-click event handler for the button. The code is: procedure TfrmMain.btnFindKeyClick(Sender: TObject); var SerialNo: word; begin //Code to check for the dongle and if found display its contents Dongle.InitKey; -- Breakpoint here Dongle.AppNumber := 1; if Dongle.CheckKey then begin SerialNo := Dongle.SerialNo; stxSerialNo.Caption := IntToStr(SerialNo); end; end; When Lazarus stops and I hover over the Dongle variable (which was created in the form's OnCreate event) I see all fields of the Dongle object and they seem to be normal, except for the FSentinelPacket. This is supposed to be an array of char [1..1028] but it says FSENTINELPACKET=#0#0#0#0Truncated 1027-1000 Does this imply that the size of the packet has been initialized erroneously? It is defined thus: ARRAY [1..1028] OF CHAR; Can the indexing be a problem? The packet is defined with a starting index of 1 rather than 0... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
In my experince sigsegv occurs mostly when a field or variable is accessed before initialization. Try to set a breakpoint in dongle.initkey call. And evaluate the dongle field (open debugger evaluate window) Look for dongle or one of the tsentinel fields being nil Liiz Em 22/06/2015 05:10, Bo Berglund bo.bergl...@gmail.com escreveu: On Mon, 22 Jun 2015 09:16:20 +0300, patspiper patspi...@gmail.com wrote: On 22/06/15 02:00, Bo Berglund wrote: I just made a first test by adding the object to my main form as a private variable. Which object? Better show the code. Here is the current state of the main form where the object is handled: unit FormMain; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Sentinel; type { TfrmMain } TfrmMain = class(TForm) btnFindKey: TButton; stxSerialNo: TStaticText; procedure btnFindKeyClick(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { private declarations } Dongle: TSentinel; == My private object variable public { public declarations } end; var frmMain: TfrmMain; implementation {$R *.lfm} { TfrmMain } procedure TfrmMain.btnFindKeyClick(Sender: TObject); var SerialNo: word; begin //Code to check for the dongle and if found display its contents Dongle.InitKey; = I get the exception here Dongle.AppNumber := 1; if Dongle.CheckKey then begin SerialNo := Dongle.SerialNo; stxSerialNo.Caption := IntToStr(SerialNo); end; end; procedure TfrmMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin Dongle.Free; = Destroying the object end; procedure TfrmMain.FormCreate(Sender: TObject); begin Dongle := TSentinel.Create; = Creating the object end; end. Project DongleTest raised exception class 'External: SIGSEGV'. The 1st thing that comes to mind is that spromeps.obj is 32 bit and your Lazarus/fpc and Windows are most probably 64 bit. But I am not sure how the compiler/linker would react to that. I think I create a 32 bit application, see below. You had posted previously: Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Not adding or removing underscores for this filetype Warning 1211: 270 comment records ignored Do you have a 64 bit version of spromeps.obj? No, this is legacy code and is only for 32 bit applications. SafeNet has created the driver for both 32 and 64 bit Windows, but the 64 bit driver is still used for 32 bit applications (like mine). Has always worked fine with the Delphi apps (used since end of the 1990:s). They did not provide a SPROMEPS.obj file for 64 bit Delphi maybe because that does not really exist yet (according to the Embarcadero user forum the newly released 64 bit compiler is not ready for prime time...) Question: Could it be that Lazarus is anyway compiling for a 64 bit application since it is installed on a 64 bit Windows 7 laptop? I just assumed that the main application would be 32 bit as is the case for Delphi But if I go into Project Options and look at Compiler Options - Config and Target - Target-specific options there is a checkbox for Win32 gui application (-WG) and it is checked. So I guess I am creating a Win32 exe as intended... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 22/06/15 17:34, Bo Berglund wrote: But your best bet is to install the 32 bit version and try it yourself. That is what I have already... I am out of ideas for now. You can ask for help on the fpc mailing list. I propose you prepare a minimum working example in an lpr file (no units, just a program which outputs to console using writeln) which only initializes the dongle/driver. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
In the breakpoint do a step into (f7) and ser the exact line that crashes Luiz Em 22/06/2015 14:03, Bo Berglund bo.bergl...@gmail.com escreveu: On Mon, 22 Jun 2015 13:29:07 -0300, luiz americo pereira camara luiz...@oi.com.br wrote: In my experince sigsegv occurs mostly when a field or variable is accessed before initialization. Try to set a breakpoint in dongle.initkey call. And evaluate the dongle field (open debugger evaluate window) Look for dongle or one of the tsentinel fields being nil I have already a breakpoint in the on-click event handler for the button. The code is: procedure TfrmMain.btnFindKeyClick(Sender: TObject); var SerialNo: word; begin //Code to check for the dongle and if found display its contents Dongle.InitKey; -- Breakpoint here Dongle.AppNumber := 1; if Dongle.CheckKey then begin SerialNo := Dongle.SerialNo; stxSerialNo.Caption := IntToStr(SerialNo); end; end; When Lazarus stops and I hover over the Dongle variable (which was created in the form's OnCreate event) I see all fields of the Dongle object and they seem to be normal, except for the FSentinelPacket. This is supposed to be an array of char [1..1028] but it says FSENTINELPACKET=#0#0#0#0Truncated 1027-1000 Does this imply that the size of the packet has been initialized erroneously? It is defined thus: ARRAY [1..1028] OF CHAR; Can the indexing be a problem? The packet is defined with a starting index of 1 rather than 0... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 22/06/15 02:00, Bo Berglund wrote: I just made a first test by adding the object to my main form as a private variable. Which object? Better show the code. It is created in the form.create event. I added a button and a static text control on the form and in the button event I added the code to initialize the dongle and read its serial number. When I stepped through the code I reached the first call to the driver via the obj file I get an exception when calling RNBOsproFormatPacket in this function, which is in the SPROMEPS.pas file supplied by SafeNet: FUNCTION SproInitialize( ApiPacket : RB_SPRO_APIPACKET_PTR ) : WORD; VAR returnVal : WORD; BEGIN returnVal := RNBOsproFormatPacket (ApiPacket, RB_SPRO_APIPACKET_SIZE); IF returnVal SP_SUCCESS THEN SproInitialize := returnVal ELSE SproInitialize := RNBOsproInitialize (ApiPacket); END; { SproInitialize } Exception text: Project DongleTest raised exception class 'External: SIGSEGV'. The 1st thing that comes to mind is that spromeps.obj is 32 bit and your Lazarus/fpc and Windows are most probably 64 bit. But I am not sure how the compiler/linker would react to that. You had posted previously: Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Not adding or removing underscores for this filetype Warning 1211: 270 comment records ignored Do you have a 64 bit version of spromeps.obj? Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 01:00:58 +0200, Bo Berglund bo.bergl...@gmail.com wrote: When I stepped through the code I reached the first call to the driver via the obj file I get an exception when calling RNBOsproFormatPacket in this function, which is in the SPROMEPS.pas file supplied by SafeNet: FUNCTION SproInitialize( ApiPacket : RB_SPRO_APIPACKET_PTR ) : WORD; VAR returnVal : WORD; BEGIN returnVal := RNBOsproFormatPacket (ApiPacket, RB_SPRO_APIPACKET_SIZE); IF returnVal SP_SUCCESS THEN SproInitialize := returnVal ELSE SproInitialize := RNBOsproInitialize (ApiPacket); END; { SproInitialize } Exception text: Project DongleTest raised exception class 'External: SIGSEGV'. To clarify: The error happens when I call RNBOsproFormatPacket, which is the first time any driver interface function is called. I have googled SIGSEGV and understand that it is a memory access error. So I followed the ApiPacket handling through the code. In the class definition file I have this: const ... RB_SPRO_APIPACKET_SIZE = 1028; ... type RB_SPRO_APIPACKET = ARRAY [1..1028] OF CHAR;{ Spro API Packet } RB_SPRO_APIPACKET_PTR = ^RB_SPRO_APIPACKET; { TSentinel } TSentinel = class private FSentinelPacket : RB_SPRO_APIPACKET; Then in the dongle initialization method I have this: {Check if the key is initialized, then find first key on system} status := InitSuperProKey(FSentinelPacket); InitSuperProKey() looks like this: function TSentinel.InitSuperProKey(var thePacket: RB_SPRO_APIPACKET): word; var error : WORD; begin Result := 0; error := SproInitialize(@thePacket); if error 0 then begin Result := error; exit; end; error := SproFindFirstUnit(@thePacket, DeveloperID); if error 0 then Result := error; end; And SproInitialize is shown in my previos post above as: FUNCTION SproInitialize( ApiPacket : RB_SPRO_APIPACKET_PTR ) : WORD; VAR returnVal : WORD; BEGIN returnVal:=RNBOsproFormatPacket (ApiPacket,RB_SPRO_APIPACKET_SIZE); IF returnVal SP_SUCCESS THEN SproInitialize := returnVal ELSE SproInitialize := RNBOsproInitialize (ApiPacket); END; { SproInitialize } So to me it seems strange that there should be a memory access problem since the packet is an array of fixed size which is a private member of the object only used by the object itself via the pointer -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 22/06/15 11:09, Bo Berglund wrote: On Mon, 22 Jun 2015 09:16:20 +0300, patspiper patspi...@gmail.com wrote: On 22/06/15 02:00, Bo Berglund wrote: I just made a first test by adding the object to my main form as a private variable. Which object? Better show the code. Here is the current state of the main form where the object is handled: unit FormMain; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Sentinel; type { TfrmMain } TfrmMain = class(TForm) btnFindKey: TButton; stxSerialNo: TStaticText; procedure btnFindKeyClick(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { private declarations } Dongle: TSentinel; == My private object variable public { public declarations } end; var frmMain: TfrmMain; implementation {$R *.lfm} { TfrmMain } procedure TfrmMain.btnFindKeyClick(Sender: TObject); var SerialNo: word; begin //Code to check for the dongle and if found display its contents Dongle.InitKey; = I get the exception here Dongle.AppNumber := 1; if Dongle.CheckKey then begin SerialNo := Dongle.SerialNo; stxSerialNo.Caption := IntToStr(SerialNo); end; end; procedure TfrmMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin Dongle.Free; = Destroying the object end; procedure TfrmMain.FormCreate(Sender: TObject); begin Dongle := TSentinel.Create; = Creating the object end; end. So the private field you are referring to is an instance of a class that you have created to handle the dongle. Project DongleTest raised exception class 'External: SIGSEGV'. The 1st thing that comes to mind is that spromeps.obj is 32 bit and your Lazarus/fpc and Windows are most probably 64 bit. But I am not sure how the compiler/linker would react to that. I think I create a 32 bit application, see below. You had posted previously: Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Not adding or removing underscores for this filetype Warning 1211: 270 comment records ignored Do you have a 64 bit version of spromeps.obj? No, this is legacy code and is only for 32 bit applications. SafeNet has created the driver for both 32 and 64 bit Windows, but the 64 bit driver is still used for 32 bit applications (like mine). Has always worked fine with the Delphi apps (used since end of the 1990:s). They did not provide a SPROMEPS.obj file for 64 bit Delphi maybe because that does not really exist yet (according to the Embarcadero user forum the newly released 64 bit compiler is not ready for prime time...) The facts: - You have 64 bit Windows - You have Delphi 32 bit compiler that produces 32 bit executables - The Safenet driver installed on 64 bit Windows works with the Delphi compiled project Question: Could it be that Lazarus is anyway compiling for a 64 bit application since it is installed on a 64 bit Windows 7 laptop? I just assumed that the main application would be 32 bit as is the case for Delphi Lazarus/fpc is 64 bit as it has been installed through the Windows installer. This the major difference. But if I go into Project Options and look at Compiler Options - Config and Target - Target-specific options there is a checkbox for Win32 gui application (-WG) and it is checked. So I guess I am creating a Win32 exe as intended... This is unrelated to the bitness of the produced executable. If you don't have a Windows 32 bit OS installation with Lazarus, and no 32 bit cross compiler, I can try to compile the basic code for you if you want in order to test. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
Il 22/06/2015 10:09, Bo Berglund ha scritto: On Mon, 22 Jun 2015 09:16:20 +0300, patspiper patspi...@gmail.com wrote: On 22/06/15 02:00, Bo Berglund wrote: I just made a first test by adding the object to my main form as a private variable. Which object? Better show the code. Here is the current state of the main form where the object is handled: unit FormMain; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Sentinel; type { TfrmMain } TfrmMain = class(TForm) btnFindKey: TButton; stxSerialNo: TStaticText; procedure btnFindKeyClick(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { private declarations } Dongle: TSentinel; == My private object variable public { public declarations } end; var frmMain: TfrmMain; implementation {$R *.lfm} { TfrmMain } procedure TfrmMain.btnFindKeyClick(Sender: TObject); var SerialNo: word; begin //Code to check for the dongle and if found display its contents Dongle.InitKey; = I get the exception here Dongle.AppNumber := 1; if Dongle.CheckKey then begin SerialNo := Dongle.SerialNo; stxSerialNo.Caption := IntToStr(SerialNo); end; end; procedure TfrmMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin Dongle.Free; = Destroying the object end; procedure TfrmMain.FormCreate(Sender: TObject); begin Dongle := TSentinel.Create; = Creating the object end; end. Project DongleTest raised exception class 'External: SIGSEGV'. The 1st thing that comes to mind is that spromeps.obj is 32 bit and your Lazarus/fpc and Windows are most probably 64 bit. But I am not sure how the compiler/linker would react to that. I think I create a 32 bit application, see below. You had posted previously: Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Not adding or removing underscores for this filetype Warning 1211: 270 comment records ignored Do you have a 64 bit version of spromeps.obj? No, this is legacy code and is only for 32 bit applications. SafeNet has created the driver for both 32 and 64 bit Windows, but the 64 bit driver is still used for 32 bit applications (like mine). Has always worked fine with the Delphi apps (used since end of the 1990:s). They did not provide a SPROMEPS.obj file for 64 bit Delphi maybe because that does not really exist yet (according to the Embarcadero user forum the newly released 64 bit compiler is not ready for prime time...) Question: Could it be that Lazarus is anyway compiling for a 64 bit application since it is installed on a 64 bit Windows 7 laptop? I just assumed that the main application would be 32 bit as is the case for Delphi But if I go into Project Options and look at Compiler Options - Config and Target - Target-specific options there is a checkbox for Win32 gui application (-WG) and it is checked. So I guess I am creating a Win32 exe as intended... Both Win32 and Win64 generate the same compiler option(-WG) In the same configuration page you should also pick up the right Target CPU family: i386 as opposed to X86_64, in order to generate a 32bit application. This will require the proper 32 bit compiler. If it isn't available or properly configurated you'll get a warning, when you click the Test button on the page. Giuliano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 09:16:20 +0300, patspiper patspi...@gmail.com wrote: On 22/06/15 02:00, Bo Berglund wrote: I just made a first test by adding the object to my main form as a private variable. Which object? Better show the code. Here is the current state of the main form where the object is handled: unit FormMain; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, Sentinel; type { TfrmMain } TfrmMain = class(TForm) btnFindKey: TButton; stxSerialNo: TStaticText; procedure btnFindKeyClick(Sender: TObject); procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { private declarations } Dongle: TSentinel; == My private object variable public { public declarations } end; var frmMain: TfrmMain; implementation {$R *.lfm} { TfrmMain } procedure TfrmMain.btnFindKeyClick(Sender: TObject); var SerialNo: word; begin //Code to check for the dongle and if found display its contents Dongle.InitKey; = I get the exception here Dongle.AppNumber := 1; if Dongle.CheckKey then begin SerialNo := Dongle.SerialNo; stxSerialNo.Caption := IntToStr(SerialNo); end; end; procedure TfrmMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); begin Dongle.Free; = Destroying the object end; procedure TfrmMain.FormCreate(Sender: TObject); begin Dongle := TSentinel.Create; = Creating the object end; end. Project DongleTest raised exception class 'External: SIGSEGV'. The 1st thing that comes to mind is that spromeps.obj is 32 bit and your Lazarus/fpc and Windows are most probably 64 bit. But I am not sure how the compiler/linker would react to that. I think I create a 32 bit application, see below. You had posted previously: Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Not adding or removing underscores for this filetype Warning 1211: 270 comment records ignored Do you have a 64 bit version of spromeps.obj? No, this is legacy code and is only for 32 bit applications. SafeNet has created the driver for both 32 and 64 bit Windows, but the 64 bit driver is still used for 32 bit applications (like mine). Has always worked fine with the Delphi apps (used since end of the 1990:s). They did not provide a SPROMEPS.obj file for 64 bit Delphi maybe because that does not really exist yet (according to the Embarcadero user forum the newly released 64 bit compiler is not ready for prime time...) Question: Could it be that Lazarus is anyway compiling for a 64 bit application since it is installed on a 64 bit Windows 7 laptop? I just assumed that the main application would be 32 bit as is the case for Delphi But if I go into Project Options and look at Compiler Options - Config and Target - Target-specific options there is a checkbox for Win32 gui application (-WG) and it is checked. So I guess I am creating a Win32 exe as intended... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
Am 22.06.2015 12:31 schrieb patspiper patspi...@gmail.com: Question: Could it be that Lazarus is anyway compiling for a 64 bit application since it is installed on a 64 bit Windows 7 laptop? I just assumed that the main application would be 32 bit as is the case for Delphi Lazarus/fpc is 64 bit as it has been installed through the Windows installer. This the major difference. At least Lazarus 1.4, AFAIK also 1.2, provides a 32-bit download even for 64-bit Windows, because of problems with libraries that are only solved once FPC 3.0.0 is released (SEH support). Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 12:39:18 +0200, Giuliano Colla giuliano.co...@fastwebnet.it wrote: Both Win32 and Win64 generate the same compiler option(-WG) In the same configuration page you should also pick up the right Target CPU family: i386 as opposed to X86_64, in order to generate a 32bit application. This will require the proper 32 bit compiler. If it isn't available or properly configurated you'll get a warning, when you click the Test button on the page. Thanks: I found these additional settings and set as follows: Target OS: Win32 Target CPU family: i386 Target processor: Default Win32 gui application: checked When I used the Test button I got this: HINT: using config file C:\programs\lazarus\fpc\2.6.4\bin\i386-win32\fpc.cfg WARNING: ppu exists twice: C:\programs\lazarus\fpc\2.6.4\units\i386-win32\fv\dialogs.ppu, C:\programs\lazarus\lcl\units\i386-win32\dialogs.ppu WARNING: ppu exists twice: C:\programs\lazarus\fpc\2.6.4\units\i386-win32\fv\menus.ppu, C:\programs\lazarus\lcl\units\i386-win32\menus.ppu I don't know/understand why the latter ppu warnings are shown... When I run with these new settings I get the exact same error at the exact same place as before. -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 13:31:29 +0300, patspiper patspi...@gmail.com wrote: The facts: - You have 64 bit Windows - You have Delphi 32 bit compiler that produces 32 bit executables - The Safenet driver installed on 64 bit Windows works with the Delphi compiled project Correct summary! Question: Could it be that Lazarus is anyway compiling for a 64 bit application since it is installed on a 64 bit Windows 7 laptop? I just assumed that the main application would be 32 bit as is the case for Delphi Lazarus/fpc is 64 bit as it has been installed through the Windows installer. This the major difference. Well, I understand that the IDE may be a 64 bit application, what I was wondering about was the target of the build. But I see tha it is a Win32 application so thta should be OK. But if I go into Project Options and look at Compiler Options - Config and Target - Target-specific options there is a checkbox for Win32 gui application (-WG) and it is checked. So I guess I am creating a Win32 exe as intended... This is unrelated to the bitness of the produced executable. If you don't have a Windows 32 bit OS installation with Lazarus, and no 32 bit cross compiler, I can try to compile the basic code for you if you want in order to test. I do not understand. I installed Lazarus a week ago from the latest release and it also included the latest fpc. This should be able to create a 32 bit application irrespecxtive of in which Windows it is installed (32/64 bit) And I cannot provide the full source because it contains proprietary key information for encrypting the data in the dongle. -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 22/06/15 15:55, Bo Berglund wrote: Question: Could it be that Lazarus is anyway compiling for a 64 bit application since it is installed on a 64 bit Windows 7 laptop? I just assumed that the main application would be 32 bit as is the case for Delphi Lazarus/fpc is 64 bit as it has been installed through the Windows installer. This the major difference. Well, I understand that the IDE may be a 64 bit application, what I was wondering about was the target of the build. But I see tha it is a Win32 application so thta should be OK. I assume the compiler you installed produces 64 bit executables by default. The Win32 GUI (-GW) description in the IDE is not exact. As per fpc help: -WG: Specify graphic type application (EMX, OS/2, Windows) Anyway, you can check any of the compiled executables. One simple way (I didn't even try it) is shown in the selected answer in http://superuser.com/questions/358434/how-to-check-if-a-binary-is-32-or-64-bit-on-windows But if I go into Project Options and look at Compiler Options - Config and Target - Target-specific options there is a checkbox for Win32 gui application (-WG) and it is checked. So I guess I am creating a Win32 exe as intended... This is unrelated to the bitness of the produced executable. If you don't have a Windows 32 bit OS installation with Lazarus, and no 32 bit cross compiler, I can try to compile the basic code for you if you want in order to test. I do not understand. I installed Lazarus a week ago from the latest release and it also included the latest fpc. This should be able to create a 32 bit application irrespecxtive of in which Windows it is installed (32/64 bit) Sven mentioned a 32 bit download for Windows, which brings up the question as to which one you have downloaded and installed. You can check http://www.lazarus-ide.org/index.php?page=downloads The following link is for the 32 bit download: http://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/Lazarus%201.4/lazarus-1.4.0-fpc-2.6.4-win32.exe/download And I cannot provide the full source because it contains proprietary key information for encrypting the data in the dongle. You can strip everything except for the initialization call. If this call succeeds then we are on the right track. But your best bet is to install the 32 bit version and try it yourself. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 17:01:45 +0300, patspiper patspi...@gmail.com wrote: Check the bitness of the produced executable. Did a check with the CygWin file command: D:\Engineering\Projects\Lazarus\LazDonglefile dongletest.exe dongletest.exe: PE32 executable (GUI) Intel 80386, for MS Windows Seems like my Lazarus produces 32 bit executables by default... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 22/06/15 15:51, Bo Berglund wrote: On Mon, 22 Jun 2015 12:39:18 +0200, Giuliano Colla giuliano.co...@fastwebnet.it wrote: Both Win32 and Win64 generate the same compiler option(-WG) In the same configuration page you should also pick up the right Target CPU family: i386 as opposed to X86_64, in order to generate a 32bit application. This will require the proper 32 bit compiler. If it isn't available or properly configurated you'll get a warning, when you click the Test button on the page. Thanks: I found these additional settings and set as follows: Target OS: Win32 Target CPU family: i386 Target processor: Default Win32 gui application: checked When I used the Test button I got this: HINT: using config file C:\programs\lazarus\fpc\2.6.4\bin\i386-win32\fpc.cfg WARNING: ppu exists twice: C:\programs\lazarus\fpc\2.6.4\units\i386-win32\fv\dialogs.ppu, C:\programs\lazarus\lcl\units\i386-win32\dialogs.ppu WARNING: ppu exists twice: C:\programs\lazarus\fpc\2.6.4\units\i386-win32\fv\menus.ppu, C:\programs\lazarus\lcl\units\i386-win32\menus.ppu I don't know/understand why the latter ppu warnings are shown... IIRC, these 2 specific warnings are benign. When I run with these new settings I get the exact same error at the exact same place as before. Check the bitness of the produced executable. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 16:48:14 +0300, patspiper patspi...@gmail.com wrote: I assume the compiler you installed produces 64 bit executables by default. The Win32 GUI (-GW) description in the IDE is not exact. As per fpc help: -WG: Specify graphic type application (EMX, OS/2, Windows) Anyway, you can check any of the compiled executables. One simple way (I didn't even try it) is shown in the selected answer in http://superuser.com/questions/358434/how-to-check-if-a-binary-is-32-or-64-bit-on-windows Did a check with the CygWin file command: D:\Engineering\Projects\Lazarus\LazDonglefile dongletest.exe dongletest.exe: PE32 executable (GUI) Intel 80386, for MS Windows Seems like my Lazarus produces 32 bit executables by default... Sven mentioned a 32 bit download for Windows, which brings up the question as to which one you have downloaded and installed. You can check http://www.lazarus-ide.org/index.php?page=downloads I downloaded and installed from this file: lazarus-1.4.0-fpc-2.6.4-win32.exe It was downloaded from: https://sourceforge.net/projects/lazarus/files/Lazarus%20Windows%2032%20bits/ And I cannot provide the full source because it contains proprietary key information for encrypting the data in the dongle. You can strip everything except for the initialization call. If this call succeeds then we are on the right track. But your best bet is to install the 32 bit version and try it yourself. That is what I have already... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 20/06/15 18:41, Bo Berglund wrote: After thinking a while more I don't really understand the problem... Why are there errors thrown for function calls originating inside the obj file functions? If the functions inside the obj function are calling Windows API functions, why should that be a problem such that Lazarus throws an error? It seems like the executable code inside the obj should be able to handle this itself, right? Add the following options to the objconv command line: -nr:GetVersion:_$dll$kernel32$GetVersion -nr:GetLastError:_$dll$kernel32$GetLastError -nr:WriteFile:_$dll$kernel32$WriteFile -nr:ReadFile:_$dll$kernel32$ReadFile -nr:DeviceIoControl:_$dll$kernel32$DeviceIoControl -nr:CloseHandle:_$dll$kernel32$CloseHandle -nr:GetTickCount:_$dll$kernel32$GetTickCount -nr:GetPrivateProfileIntA:_$dll$kernel32$GetPrivateProfileIntA -nr:GetPrivateProfileStringA:_$dll$kernel32$GetPrivateProfileStringA -nr:CreateFileA:_$dll$kernel32$CreateFileA You might have to add to the project's linker options (-k): -lkernel32 If Lazarus can't locate it, search for libkernel32.a and put it in the project folder to test (you can use the linker option -L to specify the libkernel32.a folder). Test and let us know what happens :) Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 21/06/15 23:35, Bo Berglund wrote: I added the -nr lines to my parameters file and re-ran the conversion. Then moved the resulting coff file to the project dir and compiled: Message pane shows: Compile Project, Target: DongleTest.exe: Success Seems like my dongle module is now compiled without errors! :) Great ;) Next task is for me to add the calls to the methods of the object to check if it will actually be able to read the dongle correctly. Something for Monday. Pls report your findings. I am curious to see if it will actually work. I wonder how spromeps.obj communicates with the dongle. Does it have a driver, and if it does how does it communicate with it? Does it work on Linux with Lazarus? Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Sun, 21 Jun 2015 19:43:10 +0300, patspiper patspi...@gmail.com wrote: Add the following options to the objconv command line: -nr:GetVersion:_$dll$kernel32$GetVersion -nr:GetLastError:_$dll$kernel32$GetLastError -nr:WriteFile:_$dll$kernel32$WriteFile -nr:ReadFile:_$dll$kernel32$ReadFile -nr:DeviceIoControl:_$dll$kernel32$DeviceIoControl -nr:CloseHandle:_$dll$kernel32$CloseHandle -nr:GetTickCount:_$dll$kernel32$GetTickCount -nr:GetPrivateProfileIntA:_$dll$kernel32$GetPrivateProfileIntA -nr:GetPrivateProfileStringA:_$dll$kernel32$GetPrivateProfileStringA -nr:CreateFileA:_$dll$kernel32$CreateFileA I did the above You might have to add to the project's linker options (-k): -lkernel32 Did not do this. If Lazarus can't locate it, search for libkernel32.a and put it in the project folder to test (you can use the linker option -L to specify the libkernel32.a folder). Did not have to do this either Test and let us know what happens :) I added the -nr lines to my parameters file and re-ran the conversion. Then moved the resulting coff file to the project dir and compiled: Message pane shows: Compile Project, Target: DongleTest.exe: Success Seems like my dongle module is now compiled without errors! :) Next task is for me to add the calls to the methods of the object to check if it will actually be able to read the dongle correctly. Something for Monday. Thanks a bunch for this immensly valuable help! -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Mon, 22 Jun 2015 00:02:40 +0300, patspiper patspi...@gmail.com wrote: On 21/06/15 23:35, Bo Berglund wrote: I added the -nr lines to my parameters file and re-ran the conversion. Then moved the resulting coff file to the project dir and compiled: Message pane shows: Compile Project, Target: DongleTest.exe: Success Seems like my dongle module is now compiled without errors! :) Great ;) Next task is for me to add the calls to the methods of the object to check if it will actually be able to read the dongle correctly. Something for Monday. Pls report your findings. I am curious to see if it will actually work. I just made a first test by adding the object to my main form as a private variable. It is created in the form.create event. I added a button and a static text control on the form and in the button event I added the code to initialize the dongle and read its serial number. When I stepped through the code I reached the first call to the driver via the obj file I get an exception when calling RNBOsproFormatPacket in this function, which is in the SPROMEPS.pas file supplied by SafeNet: FUNCTION SproInitialize( ApiPacket : RB_SPRO_APIPACKET_PTR ) : WORD; VAR returnVal : WORD; BEGIN returnVal := RNBOsproFormatPacket (ApiPacket, RB_SPRO_APIPACKET_SIZE); IF returnVal SP_SUCCESS THEN SproInitialize := returnVal ELSE SproInitialize := RNBOsproInitialize (ApiPacket); END; { SproInitialize } Exception text: Project DongleTest raised exception class 'External: SIGSEGV'. I wonder how spromeps.obj communicates with the dongle. Does it have a driver, and if it does how does it communicate with it? Yes, there is a driver involved and I have installed it in Winodws7 and it works just fine with my Delphi applications. How the application communicates with the driver is unknown by me, it is hidden inside the SPROMEPS.obj file Does it work on Linux with Lazarus? I have no idea but I doubt it. There is some support for Linux with GNU C++ on Linux, but I have never used that... In fact I have never programmed in Linux, except for PHP (web functionality). It seems like the very first time I call any function towards the driver I get the exception SIGSEGV whatever that may mean... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 19/06/15 22:44, Bo Berglund wrote: The error message when compiling the source: DongleTest.lpr(22,1) Error: Undefined symbol: SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD In SproMeps.pas: implementation FUNCTION RNBOsproFormatPacket( ApiPacket : RB_SPRO_APIPACKET_PTR; thePacketSize : WORD ) : WORD; STDCALL; EXTERNAL; I did not really understand any of teh discussions in the linked articles... Any idea what to do for this particular functio? There are 13 in total.. What's the output of objconv -dfhs SPROMEPS.coff? In particular, check the mangled name of RNBOsproFormatPacket and list it here. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 20/06/15 11:38, Bo Berglund wrote: On Fri, 19 Jun 2015 23:01:36 +0200, Marc Weustink m...@dommelstein.nl wrote: Just guessing, I've no experience with this. 1) Use the converter tool to dump the exported function names from the original .obj 2) look for an exported name which looks like RNBOsproFormatPacket 3) use the name conversion option of the converter tool to map the name you found to SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD (see manual) 4) do this for all 13 functions Thanks very much! This seems to be the way to go! By creating a coff file from the obj file while aliasing the functions to the long format found in the error messages and using the resulting coff file in the include statement ALL errors concerning the SPROMEPS functions disappeared! But now I have a list of other errors like this: Compile Project, Target: DongleTest.exe: Exit code 1, Errors: 10, Hints: 20 Spromeps.pas(13,2) Note: Ignored compiler switch $F Spromeps.pas(129,4) Hint: Unit windows not used in SproMeps DongleTest.lpr(23,1) Error: Undefined symbol: GetVersion DongleTest.lpr(23,1) Error: Undefined symbol: GetLastError DongleTest.lpr(23,1) Error: Undefined symbol: WriteFile DongleTest.lpr(23,1) Error: Undefined symbol: ReadFile DongleTest.lpr(23,1) Error: Undefined symbol: DeviceIoControl DongleTest.lpr(23,1) Error: Undefined symbol: CloseHandle DongleTest.lpr(23,1) Error: Undefined symbol: GetTickCount DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileIntA DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileStringA DongleTest.lpr(23,1) Error: Undefined symbol: CreateFileA I even added an implementation uses clause Windows since I recognized some of these as Windows API names, but it did not work no matter where I put the uses Windows (interface or implementation in SPROMEPS.pas or in the main project file). Seems like I am almost there except this list of errors These are used in SPROMEPS.OBJ. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Sat, 20 Jun 2015 12:51:35 +0300, patspiper patspi...@gmail.com wrote: On 20/06/15 11:38, Bo Berglund wrote: On Fri, 19 Jun 2015 23:01:36 +0200, Marc Weustink m...@dommelstein.nl wrote: Thanks very much! This seems to be the way to go! By creating a coff file from the obj file while aliasing the functions to the long format found in the error messages and using the resulting coff file in the include statement ALL errors concerning the SPROMEPS functions disappeared! Care to share the aliasing details? I made a batch file with a command like this: objconv -nu -fcoff @params.txt SPROMEPS.obj SPROMEPS.coff All arguments are in the params.txt file like this: -ar:RNBOsproFormatPacket:SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD -ar:RNBOsproInitialize:SPROMEPS_RNBOSPROINITIALIZE$RB_SPRO_APIPACKET_PTR$$WORD -ar:RNBOsproGetFullStatus:SPROMEPS_RNBOSPROGETFULLSTATUS$RB_SPRO_APIPACKET_PTR$$WORD -ar:RNBOsproGetVersion:SPROMEPS_RNBOSPROGETVERSION$RB_SPRO_APIPACKET_PTR$POINTER$POINTER$POINTER$POINTER$$WORD -ar:RNBOsproFindFirstUnit:SPROMEPS_RNBOSPROFINDFIRSTUNIT$RB_SPRO_APIPACKET_PTR$WORD$$WORD -ar:RNBOsproFindNextUnit:SPROMEPS_RNBOSPROFINDNEXTUNIT$RB_SPRO_APIPACKET_PTR$$WORD -ar:RNBOsproRead:SPROMEPS_RNBOSPROREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$$WORD -ar:RNBOsproExtendedRead:SPROMEPS_RNBOSPROEXTENDEDREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$$WORD -ar:RNBOsproWrite:SPROMEPS_RNBOSPROWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$BYTE$$WORD -ar:RNBOsproOverwrite:SPROMEPS_RNBOSPROOVERWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$WORD$BYTE$$WORD -ar:RNBOsproDecrement:SPROMEPS_RNBOSPRODECREMENT$RB_SPRO_APIPACKET_PTR$WORD$WORD$$WORD -ar:RNBOsproActivate:SPROMEPS_RNBOSPROACTIVATE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$$WORD -ar:RNBOsproQuery:SPROMEPS_RNBOSPROQUERY$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$POINTER$WORD$$WORD This is what i saw while running the batch file: objconv -nu -fcoff @params.txt SPROMEPS.obj SPROMEPS.coff Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Not adding or removing underscores for this filetype Warning 1211: 270 comment records ignored 0 Debug sections removed 0 Exception sections removed 13 Symbol names changed 13 Public symbol names aliased What's line 23 of DongleTest.lpr? That is the closing line of the main lpr file: end. So it is probably something that is not really in my code... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Sat, 20 Jun 2015 13:49:00 +0300, patspiper patspi...@gmail.com wrote: Seems like I am almost there except this list of errors These are used in SPROMEPS.OBJ. I figured as much, problem is why that works in Delphi but not in FPC/Lazarus? The special functions would of course need the definitions etc, but the WinAPI calls should just execute, or not? -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Fri, 19 Jun 2015 23:01:36 +0200, Marc Weustink m...@dommelstein.nl wrote: Just guessing, I've no experience with this. 1) Use the converter tool to dump the exported function names from the original .obj 2) look for an exported name which looks like RNBOsproFormatPacket 3) use the name conversion option of the converter tool to map the name you found to SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD (see manual) 4) do this for all 13 functions Thanks very much! This seems to be the way to go! By creating a coff file from the obj file while aliasing the functions to the long format found in the error messages and using the resulting coff file in the include statement ALL errors concerning the SPROMEPS functions disappeared! But now I have a list of other errors like this: Compile Project, Target: DongleTest.exe: Exit code 1, Errors: 10, Hints: 20 Spromeps.pas(13,2) Note: Ignored compiler switch $F Spromeps.pas(129,4) Hint: Unit windows not used in SproMeps DongleTest.lpr(23,1) Error: Undefined symbol: GetVersion DongleTest.lpr(23,1) Error: Undefined symbol: GetLastError DongleTest.lpr(23,1) Error: Undefined symbol: WriteFile DongleTest.lpr(23,1) Error: Undefined symbol: ReadFile DongleTest.lpr(23,1) Error: Undefined symbol: DeviceIoControl DongleTest.lpr(23,1) Error: Undefined symbol: CloseHandle DongleTest.lpr(23,1) Error: Undefined symbol: GetTickCount DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileIntA DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileStringA DongleTest.lpr(23,1) Error: Undefined symbol: CreateFileA I even added an implementation uses clause Windows since I recognized some of these as Windows API names, but it did not work no matter where I put the uses Windows (interface or implementation in SPROMEPS.pas or in the main project file). Seems like I am almost there except this list of errors -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 20/06/15 11:38, Bo Berglund wrote: On Fri, 19 Jun 2015 23:01:36 +0200, Marc Weustink m...@dommelstein.nl wrote: Just guessing, I've no experience with this. 1) Use the converter tool to dump the exported function names from the original .obj 2) look for an exported name which looks like RNBOsproFormatPacket 3) use the name conversion option of the converter tool to map the name you found to SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD (see manual) 4) do this for all 13 functions Thanks very much! This seems to be the way to go! By creating a coff file from the obj file while aliasing the functions to the long format found in the error messages and using the resulting coff file in the include statement ALL errors concerning the SPROMEPS functions disappeared! Care to share the aliasing details? But now I have a list of other errors like this: Compile Project, Target: DongleTest.exe: Exit code 1, Errors: 10, Hints: 20 Spromeps.pas(13,2) Note: Ignored compiler switch $F Spromeps.pas(129,4) Hint: Unit windows not used in SproMeps DongleTest.lpr(23,1) Error: Undefined symbol: GetVersion DongleTest.lpr(23,1) Error: Undefined symbol: GetLastError DongleTest.lpr(23,1) Error: Undefined symbol: WriteFile DongleTest.lpr(23,1) Error: Undefined symbol: ReadFile DongleTest.lpr(23,1) Error: Undefined symbol: DeviceIoControl DongleTest.lpr(23,1) Error: Undefined symbol: CloseHandle DongleTest.lpr(23,1) Error: Undefined symbol: GetTickCount DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileIntA DongleTest.lpr(23,1) Error: Undefined symbol: GetPrivateProfileStringA DongleTest.lpr(23,1) Error: Undefined symbol: CreateFileA I even added an implementation uses clause Windows since I recognized some of these as Windows API names, but it did not work no matter where I put the uses Windows (interface or implementation in SPROMEPS.pas or in the main project file). Seems like I am almost there except this list of errors What's line 23 of DongleTest.lpr? Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 20/06/15 14:20, Bo Berglund wrote: On Sat, 20 Jun 2015 12:51:35 +0300, patspiper patspi...@gmail.com wrote: On 20/06/15 11:38, Bo Berglund wrote: On Fri, 19 Jun 2015 23:01:36 +0200, Marc Weustink m...@dommelstein.nl wrote: Thanks very much! This seems to be the way to go! By creating a coff file from the obj file while aliasing the functions to the long format found in the error messages and using the resulting coff file in the include statement ALL errors concerning the SPROMEPS functions disappeared! Care to share the aliasing details? I made a batch file with a command like this: objconv -nu -fcoff @params.txt SPROMEPS.obj SPROMEPS.coff All arguments are in the params.txt file like this: -ar:RNBOsproFormatPacket:SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD -ar:RNBOsproInitialize:SPROMEPS_RNBOSPROINITIALIZE$RB_SPRO_APIPACKET_PTR$$WORD -ar:RNBOsproGetFullStatus:SPROMEPS_RNBOSPROGETFULLSTATUS$RB_SPRO_APIPACKET_PTR$$WORD -ar:RNBOsproGetVersion:SPROMEPS_RNBOSPROGETVERSION$RB_SPRO_APIPACKET_PTR$POINTER$POINTER$POINTER$POINTER$$WORD -ar:RNBOsproFindFirstUnit:SPROMEPS_RNBOSPROFINDFIRSTUNIT$RB_SPRO_APIPACKET_PTR$WORD$$WORD -ar:RNBOsproFindNextUnit:SPROMEPS_RNBOSPROFINDNEXTUNIT$RB_SPRO_APIPACKET_PTR$$WORD -ar:RNBOsproRead:SPROMEPS_RNBOSPROREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$$WORD -ar:RNBOsproExtendedRead:SPROMEPS_RNBOSPROEXTENDEDREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$$WORD -ar:RNBOsproWrite:SPROMEPS_RNBOSPROWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$BYTE$$WORD -ar:RNBOsproOverwrite:SPROMEPS_RNBOSPROOVERWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$WORD$BYTE$$WORD -ar:RNBOsproDecrement:SPROMEPS_RNBOSPRODECREMENT$RB_SPRO_APIPACKET_PTR$WORD$WORD$$WORD -ar:RNBOsproActivate:SPROMEPS_RNBOSPROACTIVATE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$$WORD -ar:RNBOsproQuery:SPROMEPS_RNBOSPROQUERY$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$POINTER$WORD$$WORD Exactly what I had figured out. This is what i saw while running the batch file: objconv -nu -fcoff @params.txt SPROMEPS.obj SPROMEPS.coff Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Not adding or removing underscores for this filetype Warning 1211: 270 comment records ignored 0 Debug sections removed 0 Exception sections removed 13 Symbol names changed 13 Public symbol names aliased What's line 23 of DongleTest.lpr? That is the closing line of the main lpr file: end. So it is probably something that is not really in my code... SPROMEPS.OBJ calls these functions. I am not sure how to command the linker to treat them accordingly. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Sat, 20 Jun 2015 11:27:27 +0300, patspiper patspi...@gmail.com wrote: What's the output of objconv -dfhs SPROMEPS.coff? In particular, check the mangled name of RNBOsproFormatPacket and list it here. See my reply to patspiper where I listed the main command and the arguments file -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Sat, 20 Jun 2015 13:33:09 +0200, Bo Berglund bo.bergl...@gmail.com wrote: On Sat, 20 Jun 2015 13:49:00 +0300, patspiper patspi...@gmail.com wrote: Seems like I am almost there except this list of errors These are used in SPROMEPS.OBJ. I figured as much, problem is why that works in Delphi but not in FPC/Lazarus? The special functions would of course need the definitions etc, but the WinAPI calls should just execute, or not? After thinking a while more I don't really understand the problem... Why are there errors thrown for function calls originating inside the obj file functions? If the functions inside the obj function are calling Windows API functions, why should that be a problem such that Lazarus throws an error? It seems like the executable code inside the obj should be able to handle this itself, right? -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 20/06/15 18:41, Bo Berglund wrote: On Sat, 20 Jun 2015 13:33:09 +0200, Bo Berglund bo.bergl...@gmail.com wrote: On Sat, 20 Jun 2015 13:49:00 +0300, patspiper patspi...@gmail.com wrote: Seems like I am almost there except this list of errors These are used in SPROMEPS.OBJ. I figured as much, problem is why that works in Delphi but not in FPC/Lazarus? The special functions would of course need the definitions etc, but the WinAPI calls should just execute, or not? After thinking a while more I don't really understand the problem... Why are there errors thrown for function calls originating inside the obj file functions? If the functions inside the obj function are calling Windows API functions, why should that be a problem such that Lazarus throws an error? It seems like the executable code inside the obj should be able to handle this itself, right? Maybe someone more knowledgeable with linkers can help better, but I think that the linker cannot know that these functions are in kernel32.dll. Do you have kernel32.lib (import library) and kernel32.dll? It should be included with the Windows sdk. http://www.mingw.org/wiki/createimportlibraries shows a way of creating an import library from a dll. Once you have the import library, try adding -lkernel32.lib to the linker options in the project options and let's see the result. Stephano -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On June 19, 2015 9:44:19 PM GMT+02:00, Bo Berglund bo.bergl...@gmail.com wrote: On Fri, 19 Jun 2015 09:42:35 -0700 (MST), leledumbo leledumbo_c...@yahoo.co.id wrote: The warning about the $F switch concerns a setting to force far calls, what is the equivalent in FPC? http://www.freepascal.org/docs-html/prog/progsu21.html And I am not sure that COFF is the correct file type to link against... yes, it is. the fact that you know in undefined symbol step says it all. Now you will need to provide how those undefined symbols actually defined. They probably occur from external function declaration, which differs from compiler to compiler. For instance: SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD is FPC's way to define: unit SPROMEPS; ... function RNBOSPROFORMATPACKET(x: RB_SPRO_APIPACKET_PTR; y: WORD): WORD; which is explained here: http://www.freepascal.org/docs-html/prog/progsu141.html#x172-1750006.2.2 and the way to modify it, such that you can match with what the object file expects: http://www.freepascal.org/docs-html/prog/progsu142.html#x173-1760006.2.3 The error message when compiling the source: DongleTest.lpr(22,1) Error: Undefined symbol: SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD In SproMeps.pas: implementation FUNCTION RNBOsproFormatPacket( ApiPacket : RB_SPRO_APIPACKET_PTR; thePacketSize : WORD ) : WORD; STDCALL; EXTERNAL; I did not really understand any of teh discussions in the linked articles... Any idea what to do for this particular functio? There are 13 in total.. Just guessing, I've no experience with this. 1) Use the converter tool to dump the exported function names from the original .obj 2) look for an exported name which looks like RNBOsproFormatPacket 3) use the name conversion option of the converter tool to map the name you found to SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD (see manual) 4) do this for all 13 functions Marc -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
José Mejuto wrote: El 19/06/2015 a las 9:50, Bo Berglund escribió: Now I am getting to the real hurdle as follows: DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading SPROMEPS.OBJ Hello, Try this tool: http://www.agner.org/optimize/#objconv Looks useful. Out of curiosity, how far can the same job be done by invoking the ld linker manually and tweaking its parameters to specify different file formats (-b or --format option)? -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
El 19/06/15 a les 09:25, Bo Berglund ha escrit: constructor TSentinel.Create; begin FTimer := TTimer.Create(Application); FTimer.Enabled := false; FTimer.Interval := 0; FTimer.OnTimer := OnCheckTimer(Self); //= Error here ... Why is this difference Delphi/FPC appearing and what can I do? Either you use {$MODE DELPHI} or you prepend the method with @, i.e. FTimer.OnTimer := @OnCheckTimer See: http://wiki.freepascal.org/Code_Conversion_Guide Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
El 19/06/15 a les 09:50, Bo Berglund ha escrit: Now I am getting to the real hurdle as follows: DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading SPROMEPS.OBJ This caused by the following line in a suppurt file from SafeNet: ... IMPLEMENTATION USES Windows; {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } { External functions } Most probably the OBJ file is in a format that ld doesn't understand, see the remark here: http://www.freepascal.org/docs-html/prog/progsu43.html#x50-490001.2.43 Maybe it's possible to convert it to a suitable format, but I cannot help you here. Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
Bo Berglund wrote: On Fri, 19 Jun 2015 12:35:28 +0200, Michael Schnell mschn...@lumino.de wrote: On 06/19/2015 12:28 PM, Bo Berglund wrote: Safenet might be able to provide a GNU C version of that file. Except I got a reply from them that they cannot support older software in FPC So I guess I have to go the Delphi DLL route instead... That has nothing to do at all with FPC. FPC uses the same linker (format) as GNU C. So you don't need to tell them anything about FPC but just mention gcc. Interesting, a number of years ago I had a discussion with them about interfacing C programs on Linux (x86) to the Linux driver they make. Apparently it does exist some support for that, but I did not pursue it because we found that we could stay on Windows (we were developing the 64 bit version of our data processing program at the time). Maybe I could go back to the info I collectad at that time and dig out some such interface file? Maybe, but remember that GCC also runs on Windows and what you're trying to do is find the right object (linkable) files for FPC + Windows. Mentioning FPC muddied the water, and gave them an excuse to wiggle out of their commitments. Stick to GCC, which is what Michael suggested in the first place, and ask for the libraries suitable for whatever variants of Windows you are interested in plus the .h file. Knowing the content of the .h file, it should be possible to get FPC (or at worst an assembler shim) to call their functions. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
El 19/06/2015 a las 9:50, Bo Berglund escribió: Now I am getting to the real hurdle as follows: DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading SPROMEPS.OBJ Hello, Try this tool: http://www.agner.org/optimize/#objconv -- -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Fri, 19 Jun 2015 12:35:28 +0200, Michael Schnell mschn...@lumino.de wrote: On 06/19/2015 12:28 PM, Bo Berglund wrote: Safenet might be able to provide a GNU C version of that file. Except I got a reply from them that they cannot support older software in FPC So I guess I have to go the Delphi DLL route instead... That has nothing to do at all with FPC. FPC uses the same linker (format) as GNU C. So you don't need to tell them anything about FPC but just mention gcc. Interesting, a number of years ago I had a discussion with them about interfacing C programs on Linux (x86) to the Linux driver they make. Apparently it does exist some support for that, but I did not pursue it because we found that we could stay on Windows (we were developing the 64 bit version of our data processing program at the time). Maybe I could go back to the info I collectad at that time and dig out some such interface file? -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Fri, 19 Jun 2015 09:38:01 +0200, Luca Olivetti l...@wetron.es wrote: El 19/06/15 a les 09:25, Bo Berglund ha escrit: constructor TSentinel.Create; begin FTimer := TTimer.Create(Application); FTimer.Enabled := false; FTimer.Interval := 0; FTimer.OnTimer := OnCheckTimer(Self); //= Error here ... Why is this difference Delphi/FPC appearing and what can I do? Either you use {$MODE DELPHI} or you prepend the method with @, i.e. FTimer.OnTimer := @OnCheckTimer See: http://wiki.freepascal.org/Code_Conversion_Guide Amazing! Minutes to get a good solution! What a difference from the Embarcadero support forum! :) The address symbol did the job! Now I am getting to the real hurdle as follows: DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading SPROMEPS.OBJ This caused by the following line in a suppurt file from SafeNet: ... IMPLEMENTATION USES Windows; {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } { External functions } ... So what I have is an OBJ file that contains the binary interface to the 12 needed Sentinel driver functions. This obj file has worked in Delphi versions from D4 up to XE5 without problems. Can it be used with Lazarus/FPC possibly with some linker switch??? -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
Bo Berglund wrote: FTimer.OnTimer := @OnCheckTimer See: http://wiki.freepascal.org/Code_Conversion_Guide Amazing! Minutes to get a good solution! What a difference from the Embarcadero support forum! :) The address symbol did the job! It's worth noting that that's one of the few language-level incompatibilities. Bites everybody :-) Now I am getting to the real hurdle as follows: DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading SPROMEPS.OBJ This caused by the following line in a suppurt file from SafeNet: .. IMPLEMENTATION USES Windows; {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } I think that takes you back to Michael's suggestion If the obj file format is not GNU/FPC compatible and can't be used by the linker in fpc, Safenet might be able to provide a GNU C version of that file. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 06/19/2015 12:28 PM, Bo Berglund wrote: Safenet might be able to provide a GNU C version of that file. Except I got a reply from them that they cannot support older software in FPC So I guess I have to go the Delphi DLL route instead... That has nothing to do at all with FPC. FPC uses the same linker (format) as GNU C. So you don't need to tell them anything about FPC but just mention gcc. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Newbie, porting class to FPC but get procedure assignment error
I am trying to make a test program in Lazarus to evaluate if I can port a dongle component in Delphi to a normal class in Lazarus. So far I had no real problems but now I don't understand what I am doing wrong. Relevant code below: TSentinel = class private FTimer: TTimer; ... procedure OnCheckTimer(Sender: TObject); ... public { Public declarations } constructor Create; ... end; constructor TSentinel.Create; begin FTimer := TTimer.Create(Application); FTimer.Enabled := false; FTimer.Interval := 0; FTimer.OnTimer := OnCheckTimer(Self); //= Error here ... end; The timer is used to automatically check the presence of the dongle so I have to assign the OnTimer procedure to the newly created TTimer object. This works fine in Delphi... On compilation I get an error message as follows. In the Delphi code there was no argument on the assignment of the OnTimer event procedure, in Lazarus it shows this error: sentinel.pas(647,21) Error: Wrong number of parameters specified for call to OnCheckTimer Using argument Self or NIL (like I often do in Delphi): sentinel.pas(647,39) Error: Incompatible type for arg no. 1: Got untyped, expected procedure variable type of procedure(TObject) of object;Register Why is this difference Delphi/FPC appearing and what can I do? -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Fri, 19 Jun 2015 08:55:47 +, Mark Morgan Lloyd markmll.laza...@telemetry.co.uk wrote: I think that takes you back to Michael's suggestion If the obj file format is not GNU/FPC compatible and can't be used by the linker in fpc, Safenet might be able to provide a GNU C version of that file. Except I got a reply from them that they cannot support older software in FPC So I guess I have to go the Delphi DLL route instead... -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On 06/19/2015 09:50 AM, Bo Berglund wrote: Now I am getting to the real hurdle as follows: DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading SPROMEPS.OBJ Googeling coff magic shows e.g. this: http://wiki.osdev.org/COFF -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Fri, 19 Jun 2015 16:01:09 +0200, José Mejuto joshy...@gmail.com wrote: El 19/06/2015 a las 9:50, Bo Berglund escribió: Now I am getting to the real hurdle as follows: DongleTest.lpr(20,1) Error: Illegal COFF Magic while reading SPROMEPS.OBJ Hello, Try this tool: http://www.agner.org/optimize/#objconv -- Thanks, I tried the converter but when I entered the command according to the manual I got an error: D:\Internet\Download\FreePascal_Lazarusobjconv -fCOFF SPROMEPS.obj SPROMEPS.coff Error 2004: Unknown command line option: fCOFF Then I tried to use a lowercase version (so NOT according to the manual) and it worked! D:\Internet\Download\FreePascal_Lazarusobjconv -fcoff SPROMEPS.obj SPROMEPS.coff Input file: SPROMEPS.obj, output file: SPROMEPS.coff Converting from OMF32 to COFF32 Warning 1211: 270 comment records ignored 0 Debug sections removed 0 Exception sections removed So now, I changed the line in SPROMEPS.pas from: {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } to {$L SPROMEPS.coff} { LINK WITH THE SUPERPRO OBJECT FILE } and the original error disappeared! Instead I now have a series of undefined identifiers to deal with: Compile Project, Target: DongleTest.exe: Exit code 1, Errors: 23, Hints: 2 Spromeps.pas(13,2) Note: Ignored compiler switch $F Spromeps.pas(129,4) Hint: Unit windows not used in SproMeps DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROINITIALIZE$RB_SPRO_APIPACKET_PTR$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROGETFULLSTATUS$RB_SPRO_APIPACKET_PTR$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROGETVERSION$RB_SPRO_APIPACKET_PTR$POINTER$POINTER$POINTER$POINTER$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROFINDFIRSTUNIT$RB_SPRO_APIPACKET_PTR$WORD$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROFINDNEXTUNIT$RB_SPRO_APIPACKET_PTR$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROEXTENDEDREAD$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$BYTE$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROOVERWRITE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$WORD$BYTE$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPRODECREMENT$RB_SPRO_APIPACKET_PTR$WORD$WORD$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROACTIVATE$RB_SPRO_APIPACKET_PTR$WORD$WORD$WORD$WORD$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: SPROMEPS_RNBOSPROQUERY$RB_SPRO_APIPACKET_PTR$WORD$POINTER$POINTER$POINTER$WORD$$WORD DongleTest.lpr(20,1) Error: Undefined symbol: GetVersion DongleTest.lpr(20,1) Error: Undefined symbol: GetLastError DongleTest.lpr(20,1) Error: Undefined symbol: WriteFile DongleTest.lpr(20,1) Error: Undefined symbol: ReadFile DongleTest.lpr(20,1) Error: Undefined symbol: DeviceIoControl DongleTest.lpr(20,1) Error: Undefined symbol: CloseHandle DongleTest.lpr(20,1) Error: Undefined symbol: GetTickCount DongleTest.lpr(20,1) Error: Undefined symbol: GetPrivateProfileIntA DongleTest.lpr(20,1) Error: Undefined symbol: GetPrivateProfileStringA DongleTest.lpr(20,1) Error: Undefined symbol: CreateFileA PROGRESS! The warning about the $F switch concerns a setting to force far calls, what is the equivalent in FPC? And I am not sure that COFF is the correct file type to link against... Have to look back on all the posts here and find what is recommended. But now is dinner time and I will quit for a while. Thanks to all who provided support to me! -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
The warning about the $F switch concerns a setting to force far calls, what is the equivalent in FPC? http://www.freepascal.org/docs-html/prog/progsu21.html And I am not sure that COFF is the correct file type to link against... yes, it is. the fact that you know in undefined symbol step says it all. Now you will need to provide how those undefined symbols actually defined. They probably occur from external function declaration, which differs from compiler to compiler. For instance: SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD is FPC's way to define: unit SPROMEPS; ... function RNBOSPROFORMATPACKET(x: RB_SPRO_APIPACKET_PTR; y: WORD): WORD; which is explained here: http://www.freepascal.org/docs-html/prog/progsu141.html#x172-1750006.2.2 and the way to modify it, such that you can match with what the object file expects: http://www.freepascal.org/docs-html/prog/progsu142.html#x173-1760006.2.3 -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Newbie-porting-class-to-FPC-but-get-procedure-assignment-error-tp4042730p4042768.html Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Fri, 19 Jun 2015 09:42:35 -0700 (MST), leledumbo leledumbo_c...@yahoo.co.id wrote: The warning about the $F switch concerns a setting to force far calls, what is the equivalent in FPC? http://www.freepascal.org/docs-html/prog/progsu21.html And I am not sure that COFF is the correct file type to link against... yes, it is. the fact that you know in undefined symbol step says it all. Now you will need to provide how those undefined symbols actually defined. They probably occur from external function declaration, which differs from compiler to compiler. For instance: SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD is FPC's way to define: unit SPROMEPS; ... function RNBOSPROFORMATPACKET(x: RB_SPRO_APIPACKET_PTR; y: WORD): WORD; which is explained here: http://www.freepascal.org/docs-html/prog/progsu141.html#x172-1750006.2.2 and the way to modify it, such that you can match with what the object file expects: http://www.freepascal.org/docs-html/prog/progsu142.html#x173-1760006.2.3 The error message when compiling the source: DongleTest.lpr(22,1) Error: Undefined symbol: SPROMEPS_RNBOSPROFORMATPACKET$RB_SPRO_APIPACKET_PTR$WORD$$WORD In SproMeps.pas: implementation FUNCTION RNBOsproFormatPacket( ApiPacket : RB_SPRO_APIPACKET_PTR; thePacketSize : WORD ) : WORD; STDCALL; EXTERNAL; I did not really understand any of teh discussions in the linked articles... Any idea what to do for this particular functio? There are 13 in total.. -- Bo Berglund Developer in Sweden -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie
Am 28.01.2014 23:45, schrieb Etienne Leblois: Dear all, I do not see why win32 lazarus should be the default on a win64 platform. The most suitable build to the platform were one works must be the default. Taking the best out of each particular platform is an implicit in the promise : Write once ... compile everywhere The allocatable memory is an improovement in win64 over win 32 (and linux64 over linux32) With Lazarus 1.2 there seems to be a i386 add-in installer for Win64 so that one can develop 32-Bit Windows applications as well, so this seems to be less of a problem indeed. Nevertheless the 2.6 series of the 64-bit compiler still has problems regarding exceptions in non-FPC binaries that were only solved in 2.7.1, so in this regard it is definitely more problematic to use the 64-bit version of Lazarus. Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie
Dear all, I do not see why win32 lazarus should be the default on a win64 platform. The most suitable build to the platform were one works must be the default. Taking the best out of each particular platform is an implicit in the promise : Write once ... compile everywhere The allocatable memory is an improovement in win64 over win 32 (and linux64 over linux32) Regards, Etienne. Message: 8 Date: Mon, 27 Jan 2014 11:17:03 +0100 From: Kostas Michalopoulos badsectorac...@gmail.com Subject: Re: [Lazarus] newbie ... IMO since most people wont care about 64bit executables, it is better to only give that [64bit] download as an alternative option in 64bit Windows systems, not as the default (and only) option. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie
Well... almost. If you go to the site with a 64bit version of Windows, you get a 64bit version of Lazarus which produces 64bit executables that do no run on 32bit systems. The only way to make it produce 32bit executables on a 64bit system is to create a special 32bit windows build profile (which you need to keep up to date) and explicitly set the target CPU/widgetset. IMO since most people wont care about 64bit executables, it is better to only give that download as an alternative option in 64bit Windows systems, not as the default (and only) option. On Sun, Jan 26, 2014 at 10:37 AM, Richard Mace richard.m...@gmail.com wrote: There is indeed and very goods it is too. Whichever Windows version you choose, Lazarus should work well for you. Richard On 26 January 2014 08:45, Sven Barth pascaldra...@googlemail.com wrote: On 26.01.2014 07:19, M.Zamil wrote: Hello all, I am new to Lazarus and I am wondering if there is a Lazarus for windows. TIA Mosaed When you visit http://www.lazarus.freepascal.org/ with a Windows OS you should already see the approbiate download link in the top right. If not, take a look here: http://www.lazarus.freepascal.org/index.php?page=downloads Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie
On 27/01/2014 11:17, Kostas Michalopoulos wrote: Well... almost. If you go to the site with a 64bit version of Windows, you get a 64bit version of Lazarus which produces 64bit executables that do no run on 32bit systems. The only way to make it produce 32bit executables on a 64bit system is to create a special 32bit windows build profile (which you need to keep up to date) and explicitly set the target CPU/widgetset. IMO since most people wont care about 64bit executables, it is better to only give that download as an alternative option in 64bit Windows systems, not as the default (and only) option. Agreed, especially given the problems with FPC 2.6.x with exceptions in DLLs (e.g. database drivers, windows explorer extensions,...) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie
On 26.01.2014 07:19, M.Zamil wrote: Hello all, I am new to Lazarus and I am wondering if there is a Lazarus for windows. TIA Mosaed When you visit http://www.lazarus.freepascal.org/ with a Windows OS you should already see the approbiate download link in the top right. If not, take a look here: http://www.lazarus.freepascal.org/index.php?page=downloads Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie
There is indeed and very goods it is too. Whichever Windows version you choose, Lazarus should work well for you. Richard On 26 January 2014 08:45, Sven Barth pascaldra...@googlemail.com wrote: On 26.01.2014 07:19, M.Zamil wrote: Hello all, I am new to Lazarus and I am wondering if there is a Lazarus for windows. TIA Mosaed When you visit http://www.lazarus.freepascal.org/ with a Windows OS you should already see the approbiate download link in the top right. If not, take a look here: http://www.lazarus.freepascal. org/index.php?page=downloads Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] newbie
Hello all, I am new to Lazarus and I am wondering if there is a Lazarus for windows. TIA Mosaed -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie needs help installing Winsoft's component COMPORT
Bob Axtell wrote: anybody have a little time to help a 71 yr ole kid just startin' out? What are you trying to interface to? If you don't need a graphical control I extended FPC's standard serial unit to work with Win-32, I think it's reliable although I usually use the Linux or Solaris variants. http://bugs.freepascal.org/view.php?id=18946 -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie needs help installing Winsoft's component COMPORT
On 12/22/2013 4:38 AM, Mark Morgan Lloyd wrote: Bob Axtell wrote: anybody have a little time to help a 71 yr ole kid just startin' out? What are you trying to interface to? If you don't need a graphical control I extended FPC's standard serial unit to work with Win-32, I think it's reliable although I usually use the Linux or Solaris variants. http://bugs.freepascal.org/view.php?id=18946 I am making a simple connection thru an RS232 LINK, and I have used Comport with Delphi6 very successfully in the past. The graphical control is needed to make the notebook app easily readable and usable by our installer, who has ASUS netbooks with WinXP installed. Thanks for taking me under your wing. --Bob -- The only place success comes before work is in the dictionary. VINCE LOMBARDI -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] newbie needs help installing Winsoft's component COMPORT
anybody have a little time to help a 71 yr ole kid just startin' out? -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] newbie question: tsqlquery; primarykey; insert.
Hi dear list members. I'm new here. Approximately 17 years ago I worked as a sysadmin, gave every day support for 70 peoples how to use their computers. I also made numerous small apps, to help the work of the firm. That time I did it with Delphi 1, used DBase and Paradox tables. I did this job for a few years, then the life pushed me away from programming, but not too far away from computers. Now I'm here, and seem to come back. My friend wants me to create a database app, because the task is just too complicated to do by himself in MS Access. I put my cents on Lazarus, as I can't afford any Delphi (and like) available today. I choosed Firebird (a very cost effective solution as well) as database engine, started with embedded, but later when as development progresses need move to real client-server. So, I created my database, that wasn't too hard with IBExpert personal (I had to look for something to substitute Database desktop). I also managed to create my autoinc fields, using Firebirds triggers and generators. Each of my tables has its own counters. But I'm stuck with getting the newly inserted rows ID. How do you get it? Or if you generate the ID on the client side, how do you make absolutely sure, no other user can get the same ID. Is there a way to ask Firebird about the next value of a generator? And then I could use that ID upon an insert, and would deactivate the triggers. If I'm on a wrong way with this ID thing, any other Best practices are welcome. ;) I highly appreciate every help word! Thank you very much in advance Laszlo Kovacs-- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie question: tsqlquery; primarykey; insert.
Le 26/11/2013 16:02, Kovács László a écrit : Hi dear list members. I'm new here. Approximately 17 years ago I worked as a sysadmin, gave every day support for 70 peoples how to use their computers. I also made numerous small apps, to help the work of the firm. That time I did it with Delphi 1, used DBase and Paradox tables. I did this job for a few years, then the life pushed me away from programming, but not too far away from computers. Now I'm here, and seem to come back. My friend wants me to create a database app, because the task is just too complicated to do by himself in MS Access. I put my cents on Lazarus, as I can't afford any Delphi (and like) available today. I choosed Firebird (a very cost effective solution as well) as database engine, started with embedded, but later when as development progresses need move to real client-server. So, I created my database, that wasn't too hard with IBExpert personal (I had to look for something to substitute Database desktop). I also managed to create my autoinc fields, using Firebirds triggers and generators. Each of my tables has its own counters. But I'm stuck with getting the newly inserted rows ID. How do you get it? Create as many sequences (new name for generators) as you need In the application when you need a new value for a sequence (an insert for instance) I execute the next query just before: */select next value for my_generator_name as column_name_i_want from rdb$database/* and I get the value with the query which executed the query (some TQuery component, using FieldByName('column_name_i_want).AsInteger or better AsLargeInt) The unique ID has been definitely reserved and the I can use it into any other update or insert with other tables. This is my way but it not the only one but because I want to control everything which reports to database, i'm used to this method Antonio. Or if you generate the ID on the client side, how do you make absolutely sure, no other user can get the same ID. That's easy: it is guaranteed by Firebirdwhatever way you choose Is there a way to ask Firebird about the next value of a generator? And then I could use that ID upon an insert, and would deactivate the triggers. yes, read above, no need to deactivate or reactivate triggers If I'm on a wrong way with this ID thing, any other Best practices are welcome. ;) I highly appreciate every help word! Thank you very much in advance Laszlo Kovacs -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie question: tsqlquery; primarykey; insert.
First let me say thank you very much Antonio and Reinier! -- Az eredeti üzenet -- Feladó: Reinier Olislagers reinierolislag...@gmail.com Címzett: Lazarus mailing list lazarus@lists.lazarus.freepascal.org Elküldött elemek: 2013.11.26. 17:05:23 Tárgy Re: [Lazarus] newbie question: tsqlquery; primarykey; insert. FYI: 1. IBExprt is a good tool, but FlameRobin is also nice (and open source). Multiplatform as well. 2. There's a Lazarus data desktop application included in (IIRC) the tools directory of your Lazarus install. Thanks for the hint on FlameRobin, I'll check it. IBExpert was really a big help for me. After you mentioned, looked for but didn't find that data desktop in the tools dir. I'm running on Windows, and just installed the latest Lazarus I could download. Should it really be there? -- Az eredeti üzenet -- Feladó: Antonio Fortuny a.fort...@sitasoftware.lu Címzett: lazarus@lists.lazarus.freepascal.org Elküldött elemek: 2013.11.26. 16:52:06 Tárgy Re: [Lazarus] newbie question: tsqlquery; primarykey; insert. In the application when you need a new value for a sequence (an insert for instance) I execute the next query just before: select next value for my_generator_name as column_name_i_want from rdb$database and I get the value with the query which executed the query (some TQuery component, using FieldByName('column_name_i_want).AsInteger or better AsLargeInt) The unique ID has been definitely reserved and the I can use it into any other update or insert with other tables. This is my way but it not the only one but because I want to control everything which reports to database, i'm used to this method Antonio. --- Antonio, thanks! That rocks! I dropped my triggers,because they are useless now. I added another query with the sql you mentioned (adapted the fields names of course :)) This is GenQuery. My original query is already open, and bound to a dbgrid, and is now just a select * from a table, I'm just testing the basics. So, this is TestQuery. I have put in TestQuery afterinsert event handler Genquery.Open; TestQuery.FieldbyName ('ID').asLargeint := GenQuery.Fields[0].asLargeint; GenQuery.Close; So if the dbgrid adds a row, I can see the newly generated ID in the column. So far, so good, one basic thing is working, the new ID is under my control, cause I can have it in a variable, if I want to, and that's vital for further processing. I think TestQuery.Post is called automatically by the DBGrid, but seems, that I have to call upplyupdates and commit. Thank you very much! Best regards Laszlo Kovacs -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie question: tsqlquery; primarykey; insert.
On 26.11.2013 22:22, Kovács László wrote: After you mentioned, looked for but didn't find that data desktop in the tools dir. I'm running on Windows, and just installed the latest Lazarus I could download. Should it really be there? The directory is %lazarus%\tools\lazdatadesktop\. There you'll find a lazdatadesktop.lpi which you'll need to compile (I don't know whether it's shipped precompiled as well). Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] [newbie question] how to make resizable tmemo?
in the recent playing around with the code in the flicker thread, i wanted to make the tmemo automatically resize to fit the form when it is resized and to keep the button where i placed it and visible... the align and alignment options confuse this old boy as does much of the GUI world of coding... i had some luck with a groupbox but it wasn't satisfactory... can someone please explain, in very simple terms and steps, how to accomplish this? i have no delphi books available and what i have looked at online has only served to confuse me further :/ advTHANKSance :) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] [newbie question] how to make resizable tmemo?
Hi waldo, Memo1.Align:=alClient; This will make the Memo sized to form size. Memo1.Alignment:=taRightJustify; This will make the text inside the Memo be right justified. To mantain a visible button, put it inside a panel and set the Align property of the panel to alTop; It runs ok for me. Hope it helps! Ed. 2013/4/30 waldo kitty wkitt...@windstream.net in the recent playing around with the code in the flicker thread, i wanted to make the tmemo automatically resize to fit the form when it is resized and to keep the button where i placed it and visible... the align and alignment options confuse this old boy as does much of the GUI world of coding... i had some luck with a groupbox but it wasn't satisfactory... can someone please explain, in very simple terms and steps, how to accomplish this? i have no delphi books available and what i have looked at online has only served to confuse me further :/ advTHANKSance :) -- NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted. -- __**_ Lazarus mailing list Lazarus@lists.lazarus.**freepascal.orgLazarus@lists.lazarus.freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarushttp://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie linking question...
On 08/13/2012 05:48 PM, Chavoux Luyt wrote: Hi guys When I try to install a new package (glScene), Slightly off-topic. I learned that glScene has been purchased by Embarcadero and has been removed from open Source. Is there still a free version of glScene and is that easily/somehow usable with Lazarus ? -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie linking question...
2012/8/14 Michael Schnell mschn...@lumino.de: On 08/13/2012 05:48 PM, Chavoux Luyt wrote: Hi guys When I try to install a new package (glScene), Slightly off-topic. I learned that glScene has been purchased by Embarcadero and has been removed from open Source. Is there still a free version of glScene and is that easily/somehow usable with Lazarus ? -Michael No, GLScene isn't purchased by Embarcadero, is still Open Source and yet developed: http://wiki.glscene.info/ Maybe you mean DXScene (http://www.ksdev.com/ http://www.ksdev.com/forums/viewtopic.php?f=3t=987 ) that is not more supported or developed as free. Fortunately I'm using GLScene :D Regards, Kjow(.net) -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie linking question...
On 14/08/2012 08:34, Michael Schnell wrote: On 08/13/2012 05:48 PM, Chavoux Luyt wrote: Hi guys When I try to install a new package (glScene), Slightly off-topic. I learned that glScene has been purchased by Embarcadero and has been removed from open Source. Is there still a free version of glScene and is that easily/somehow usable with Lazarus ? -Michael I think it's DXScene, not GLScene, that EB uses: http://www.pascalgamedevelopment.com/archive/index.php?t-10819.html L. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie linking question...
On 08/14/2012 09:55 AM, Kjow wrote: Maybe you mean DXScene Yep. Thanks for the pointers ! -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Newbie linking question...
Hi guys When I try to install a new package (glScene), everything seems to compile fine, only to stop with a fatal error: /usr/bin/ld: warning: ../link.res contains output sections; did you forget -T? /usr/bin/ld: cannot find -lXxf86vm lazarus.pp(133,1) Error: Error while linking lazarus.pp(133,1) Fatal: There were 1 errors compiling module, stopping what is this lXxf86vm file? I have installed the new Lazarus (lazarus_1.0RC1-0_i386.deb and fpc_2.6.0-120728.deb). Thanks in advance Chavoux -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie linking question...
On Mon, Aug 13, 2012 at 12:48 PM, Chavoux Luyt chav...@gmail.com wrote: /usr/bin/ld: cannot find -lXxf86vm lazarus.pp(133,1) Error: Error while linking lazarus.pp(133,1) Fatal: There were 1 errors compiling module, stopping I believe you are using ubuntu, and this is happening because a missing library. Try to install the following package: libxxf86vm-dev sudo apt-get install libxxf86vm-dev -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Newbie linking question...
Thanks Daniel On 13 August 2012 19:12, Daniel Gaspary dgasp...@gmail.com wrote: I believe you are using ubuntu, and this is happening because a missing library. Try to install the following package: libxxf86vm-dev sudo apt-get install libxxf86vm-dev I am actually using Debian, but that solved the problem. Cheers Chavoux -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie questions
it uses windows, graph; where can I find reference info, examples and other doc about these libs? Windows unit is a binding to Windows API. It's not documented as it would be HUGE work and too duplicated since MSDN already documents it very well. The problem is that you have to understand C a bit, in particular, how to map C things to their Pascal equivalent, when reading MSDN docs. if I vould like to port this program under Linux I imagine that the windows lib could be unusable. The shortest way to do it is ... ? Hints on how to do it are where? Depends on how tight the code is to Windows API. In short, you have to find all Windows API specific usage, and replace it with its equivalent on your target platform. Using LCL (via LCLType, LCLProc and LCLIntf), some of the Windows API specific things are made cross-platform with the same interface as Windows API one. This is not the recommended way to write cross-platform apps, but it can't help quick and dirty porting. You can find some articles regarding multiplatform programming here: http://wiki.freepascal.org/Multiplatform_Programming_Guide -- View this message in context: http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-newbie-questions-tp4024223p4024289.html Sent from the Free Pascal - Lazarus mailing list archive at Nabble.com. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie questions
Hi Marco, I'm probably not the best person to welcome you, but as a fellow potterer who has been using Lazarus for a number of small projects, over the last ten years or so, welcome! This is the ml I use whenever I want to ask questions and nobody has (yet!) disabused me, so I think you've come to the right place Lazarus is still pretty close to Delhi and I still use the help files that came with my Delphi 3 installation for reference. There are differences, though, but there is a lot of help on the Internet. Such as this page: http://wiki.lazarus.freepascal.org/Multiplatform_Programming_Guide On 1 June 2012 12:05, Marco Ciampa ciam...@libero.it wrote: 1) is this a developers only ml? Am I in the wrong list to ask general usage questions? I case vould you (please) point me to the right ml? TIA 2) the real question(s). I work in a high school. I do not usually use fpc/lazarus but the whole project is interesting for me since it is able to do so many things that I've never seen in any other RAD tool, free or not. We use fpc for education (algorithms/logic/etc.) mainly in the small time space in the math lessons but: - DevPascal is old, buggy, undeveloped, untranslated and somehow works very bad under Windows if you are not an administrator (like a student in a school PC) - FreePascal is a Dos app. , really ugly as was TP 20 years ago with similar concern regarding the multiuser use with Win... - Lazarus works perfectly in Windows, is easy to install in school as at home and it works under Linux and Mac which is a real plus. I've found some Delphi examples around in Internet, like this site: http://www.pierotofy.it/pages/sorgenti/Pascal/ in particular this small game: http://www.pierotofy.it/pages/sorgenti/dettagli/18955-Connect_Four/ If I import in Lazarus it works like a charm. Ok now the real questions: 1) it uses windows, graph; where can I find reference info, examples and other doc about these libs? 2) if I vould like to port this program under Linux I imagine that the windows lib could be unusable. The shortest way to do it is ... ? Hints on how to do it are where? TIA -- Marco Ciampa ++ | Linux User #78271 | | FSFE fellow #364 | ++ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie questions
Marco Ciampa ciam...@libero.it hat am 1. Juni 2012 um 12:05 geschrieben: 1) is this a developers only ml? Am I in the wrong list to ask general usage questions? I case vould you (please) point me to the right ml? TIA You are welcome. This list is about Lazarus. There are many other lists about fpc in general and about using fpc with other libraries/projects. 2) the real question(s). I work in a high school. I do not usually use fpc/lazarus but the whole project is interesting for me since it is able to do so many things that I've never seen in any other RAD tool, free or not. :) We use fpc for education (algorithms/logic/etc.) mainly in the small time space in the math lessons but: - DevPascal is old, buggy, undeveloped, untranslated and somehow works very bad under Windows if you are not an administrator (like a student in a school PC) - FreePascal is a Dos app. , really ugly as was TP 20 years ago with similar concern regarding the multiuser use with Win... No, Free Pascal is the compiler, some tools and a lot of libraries. It also has a console IDE called fp. Most compilers are command line utilities and fpc is no exception. Lazarus simply calls fpc to compile your code. Console applications are far older than DOS, still the best tool for many tasks and there are still new console tools are invented. - Lazarus works perfectly in Windows, is easy to install in school as at home and it works under Linux and Mac which is a real plus. I've found some Delphi examples around in Internet, like this site: http://www.pierotofy.it/pages/sorgenti/Pascal/ in particular this small game: http://www.pierotofy.it/pages/sorgenti/dettagli/18955-Connect_Four/ If I import in Lazarus it works like a charm. Ok now the real questions: 1) it uses windows, graph; where can I find reference info, examples and other doc about these libs? These are not Lazarus units. The windows unit is simply the binding to the MS Windows libraries, so you can find the information at msdn. I never used the graph unit, so I can't help here. 2) if I vould like to port this program under Linux I imagine that the windows lib could be unusable. The shortest way to do it is ... ? Hints on how to do it are where? The graph unit exists under Linux too. FPC provides platform independent functions for most system tasks. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie questions
On Fri, Jun 01, 2012 at 12:28:40PM +0200, Dave Coventry wrote: Hi Marco, Lazarus is still pretty close to Delhi and I still use the help files that came with my Delphi 3 installation for reference. Too bad. So for Lazarus use I have to study (and buy!) Delphi first... very strange situation for a free software. I understand why it is so but ... maybe a free documentation project could rightly fit here... Thanks for the info, I'll do some experiments... -- Marco Ciampa ++ | Linux User #78271 | | FSFE fellow #364 | ++ -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie questions
Marco Ciampa ciam...@libero.it hat am 1. Juni 2012 um 13:19 geschrieben: On Fri, Jun 01, 2012 at 12:28:40PM +0200, Dave Coventry wrote: Hi Marco, Lazarus is still pretty close to Delhi and I still use the help files that came with my Delphi 3 installation for reference. Too bad. So for Lazarus use I have to study (and buy!) Delphi first... very strange situation for a free software. I understand why it is so but ... maybe a free documentation project could rightly fit here... Thanks for the info, I'll do some experiments... There are already thousands of pages of documentation for FPC and Lazarus. And there are books and forums and much more. The Delphi 3 help files are a very good quality, most things are still correct and some topics are better explained there (better depends on your background and taste). There is nothing wrong to read them as an introduction, but you should read the FPC/Lazarus docs too. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie questions
On 2012-06-01 13:19, Marco Ciampa wrote: On Fri, Jun 01, 2012 at 12:28:40PM +0200, Dave Coventry wrote: Hi Marco, Lazarus is still pretty close to Delhi and I still use the help files that came with my Delphi 3 installation for reference. Too bad. So for Lazarus use I have to study (and buy!) Delphi first... very strange situation for a free software. I understand why it is so but ... maybe a free documentation project could rightly fit here... This is not entirely true! Embacardo (who owns the Delphi brand now) have placed the entire API documentation on their website here: http://docwiki.embarcadero.com/Libraries/en/Main_Page And as I have understood the Lazarus project, a major aim is to be Dephi compatible as much as possible (I this goes for FreePascal as well). So most of this documentation should fit the general need. I personally use the online API documentation for RTL, FCL and LCL which can be found here: http://lazarus-ccr.sourceforge.net/docs/ Kind regards, Torsten Bonde Christiansen. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] newbie questions
Am 01.06.2012 13:08, schrieb Marco Ciampa: On Fri, Jun 01, 2012 at 12:05:23PM +0200, Marco Ciampa wrote: - FreePascal is a Dos app. , really ugly as was TP 20 years ago with similar concern regarding the multiuser use with Win... I meant the FreePascal IDE that comes if you download the FreePascal package. Put yourself in the shoes of a student: this is FreePascal, it is written everywhere... may be a good idea to change the package name into FreePascal_IDE... but of course I know that fpc is the common underlying compiler of all. I was comparing IDEs... It's not an extra package it is PART of the Free Pascal distribution (and it's Free Pascal, not FreePascal). Also it's called fp already... Also there are people that liked and still like the look and feel of the Turbo Pascal IDE (tough I'll always prefer a good GUI like Lazarus to fp). Regards, Sven -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus