[Lazarus] cross platform pre-compile processing
Hi, I need to run a program before compile my program, so I set it in lazarus's project settings. It works fine, but, how can I make it a platform dependent config, i.e. run "prepare" if the project is compiled under linux, and run "prepare.exe" if it is compiled on Windows. Thanks! Xiangrong -- ___ 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
On June 19, 2015 9:44:19 PM GMT+02:00, Bo Berglund wrote: >On Fri, 19 Jun 2015 09:42:35 -0700 (MST), leledumbo > 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
On Fri, 19 Jun 2015 09:42:35 -0700 (MST), leledumbo 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] Firebird DB replication options
On Fri, 19 Jun 2015, Graeme Geldenhuys wrote: Hi, [Apologies in advance - I know this is not a Firebird list, but here are many Firebird DB users that could possibly comment.] Has anybody here used any Firebird database replication software? I've been reading up on it a bit, and there seems to be more options available that I expected. Has anybody tried any of them, and could possibly give some comment. Do you want replication or clustering ? I have looked into this problem several times. From my point of view, all of these solutions suffer from the same problems: a) they slow down the database. and b) if the database structure changes often, it is a pain to maintain. The only correct way to implement this is in the server engine itself; until that is done, these are crude and makeshift solutions. (e.g. Postgres got it correct with their 'slony' replication) IMHO You're better of using nbackup to rebuild the database remotely. At the very least, that requires no extra triggers, log tables and whatnot, and will not slow down the database. If your database structure is fixed, you don't update very often, the tools you mention can be acceptable. If so, then I'd recommend going with the firebird native tools, such as ibreplicator. 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
> 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
[Lazarus] Firebird DB replication options
Hi, [Apologies in advance - I know this is not a Firebird list, but here are many Firebird DB users that could possibly comment.] Has anybody here used any Firebird database replication software? I've been reading up on it a bit, and there seems to be more options available that I expected. Has anybody tried any of them, and could possibly give some comment. IBReplicator - commercial, cross-platform, full-featured http://www.ibphoenix.com/products/software/ibreplicator FiBRE - open source, cross-platform http://fibre.sourceforge.net/ FBReplicator - open source http://www.meta.com.au IBO Replication Module - Delphi/C++ Builder components http://www.ibobjects.com/iborpl.html ReplicadorBR - open source http://sourceforge.net/projects/replicadorbr/ Replicador Firebird - freeware Originally available from http://replicadorfirebird.ich.pro.br/ Download (2.2MB zip file) from: http://firebirdfaq.org/files/Replicador_Firebird_1.0.12.7z CopyCat (components) and CopyTiger (application) - commercial http://www.microtec.fr/copycat/ ININ Replication Manager - commercial http://www.inin.hr/ Daffodil Replicator - commercial http://enterprise.replicator.daffodilsw.com/index.html DB Replicator - open source fork of Daffodil http://dbreplicator.org/ DBRE - open source, supports Firebird and MySQL http://dbre.sourceforge.net/ IB LogManager - not a real replicator, but helps setting up a hot-standby environment easily: http://www.upscene.com/products/audit/iblm_main.htm Demo Flash movie available here: http://www.iblogmanager.com/download/demos/iblm/iblm_hotstandby.htm SymmetricsDS - open source, cross platform, supports various DBMS: http://www.symmetricds.org Frext - Doesn't seem to have started yet, good research info. http://frext.sourceforge.net/ Regards, - Graeme - -- ___ 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 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_Lazarus>objconv -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_Lazarus>objconv -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
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 2015-06-19 11:28, Bo Berglund wrote: > Except I got a reply from them that they cannot support older software > in FPC And why we love ISV's and closed source software. ;-) 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 Fri, 19 Jun 2015 12:35:28 +0200, Michael Schnell 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] Different packages for different usage
On 2015-06-19 12:53, Mattias Gaertner wrote: > > Note: The "tiopf:=/data/devel/tiopf/" is an absolute path, so when you > give your projects to another developer, he has to change > this macro in every project and every time you give him a new copy. Yes I know it is an absolute path - as defined for my system. They don't however need to modify it every time they get a new copy (eg: from a code repository). They could override it via the "Stored in session only *.lps" section. So they can do a 'svn up' without loosing there customisations. > As alternative you can use "Addition and Overrides" to add the > macro to all your projects. The other developer only needs to do this > once as well. Probably even better. Thanks for that info. 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] Different packages for different usage
On Fri, 19 Jun 2015 12:38:39 +0100 Graeme Geldenhuys wrote: > On 2015-06-19 12:09, aradeonas wrote: > > So 'Custom options' work like 'Additions and Overrides' but second one > > is more specific? > > I believe Mattias said it all. As far as I understand "Additions and > Overrides" pass settings on to packages too. It allows any combination. Only project, only packages, only one packages, all packages except one, etc ... > The "Custom Options" allows > you to add any compiler settings, and only apply them to the specific > project (not passed on to package dependencies). > > In the example I attached I didn't use packages, so the difference is > probably moot. > > TIP: > Created a new project, set your most often used IDE Macros (eg: > tiopf:=/data/devel/tiopf/), then tick the "Set compiler options as > default" and click OK. Now wherever you create a new project, your most > used IDE Macros are already defined. Every little bit helps save time. ;-) Note: The "tiopf:=/data/devel/tiopf/" is an absolute path, so when you give your projects to another developer, he has to change this macro in every project and every time you give him a new copy. As alternative you can use "Addition and Overrides" to add the macro to all your projects. The other developer only needs to do this once as well. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
> TIP: Created a new project, set your most often used IDE Macros (eg: tiopf:=/data/devel/tiopf/), then tick the "Set compiler options as default" and click OK. Now wherever you create a new project, your most used IDE Macros are already defined. Every little bit helps save time. ;-) > Thank you Graeme, you helped me as always. Regards, Ara -- http://www.fastmail.com - The way an email service should be -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Streaming TStringList with associated objects
On Fri, 19 Jun 2015 18:29:58 +0700 Kiên Nguyễn Tiến Trung wrote: > I have a TStringList containing some strings. Each strings is associated > with an object typed TPersistent. I realize that, when streaming > TStringList, all of associated objects are ignored. > > What I have to do? You could a new TStringList descendent and override DefineProperties. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
On 2015-06-19 12:09, aradeonas wrote: > So 'Custom options' work like 'Additions and Overrides' but second one > is more specific? I believe Mattias said it all. As far as I understand "Additions and Overrides" pass settings on to packages too. The "Custom Options" allows you to add any compiler settings, and only apply them to the specific project (not passed on to package dependencies). In the example I attached I didn't use packages, so the difference is probably moot. TIP: Created a new project, set your most often used IDE Macros (eg: tiopf:=/data/devel/tiopf/), then tick the "Set compiler options as default" and click OK. Now wherever you create a new project, your most used IDE Macros are already defined. Every little bit helps save time. ;-) 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] Different packages for different usage
> "Custom options" is a plain field, simply passed to the compiler. > Mostly used for uncommon options that have no GUI element in the IDE. > > Additions and Overrides is for complex projects with many targets and > flags (e.g. release/debug, Windows/Linux, experiments, many > developers). The later allows to enable/disable flags with simple > mouse clicks. Understood,thank you. Ara -- http://www.fastmail.com - Faster than the air-speed velocity of an unladen european swallow -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Streaming TStringList with associated objects
I have a TStringList containing some strings. Each strings is associated with an object typed TPersistent. I realize that, when streaming TStringList, all of associated objects are ignored. What I have to do? -- ___ 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 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] Different packages for different usage
On Fri, 19 Jun 2015 04:09:04 -0700 aradeonas wrote: > Thank you very much Graeme. > > So 'Custom options' work like 'Additions and Overrides' but second one > is more specific? "Custom options" is a plain field, simply passed to the compiler. Mostly used for uncommon options that have no GUI element in the IDE. Additions and Overrides is for complex projects with many targets and flags (e.g. release/debug, Windows/Linux, experiments, many developers). The later allows to enable/disable flags with simple mouse clicks. Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
> The compiler run **before* *the application is running Agree,silly question! > Please define what you mean with "is running in non graphical OS". I have a simple vps with red hat os on it with only terminal so if I want to run any app that need LCL it will crash ,so all my server apps should not depend on graphical package and then it will run smoothly. Regards, Ara -- http://www.fastmail.com - A fast, anti-spam email service. -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
On Fri, 19 Jun 2015 03:53:10 -0700 aradeonas wrote: > Beautiful! Thank you Graeme and Mattias and also Juha. > > So summery is when I have 2 package named clientpkg and serverpkg with > shared unit but fist one with graphical dependencies so when I make an > server app I should declare for example -ThisIsServer and for client > nothing and in code use compiler condition so when ThisIsServer declared > I exclude graphical code. Yes, pass -dThisIsServer to the compiler. > Correct and this is the best way? Depends. Some people don't like scattering their code with IFDEFs. Sven gave you an alternative with abstract classes. > Also I want to ask how can I find out my app is running in non graphical > OS?with compiler condition? The compiler run *before* the application is running. So, no there is no compiler condition. Please define what you mean with "is running in non graphical OS". Mattias -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
Thank you very much Graeme. So 'Custom options' work like 'Additions and Overrides' but second one is more specific? Ara -- http://www.fastmail.com - Same, same, but different... -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
On 2015-06-19 11:22, aradeonas wrote: > About Compiler Defines,until now I couldn't make them work,I don't know > why! can you show me an simple example? Attached is an example which has common code (with IFDEF's), a console Server app (non GUI), and a Client (gui) app. Notes: - In both the Client and Server apps there is a IDE Macro in "Project Options / Compiler Options / Additions and Overrides" that defines the location of the common code. Change that to match your location. I normally set this to the root of my project directory. - In the Client app it defines a "ClientApp" compiler define in "Project Options / Compiler Options / Other". The server app doesn't have this, and that is what allows you to separate the dependencies in the common code. No Lazarus Packages are used, other than the LCL.lpk for the client app. Save the attachment and remove the extra extension '.RemoveMe', then unpack as normal. The extra file extension is added to circumvent stupid attachment rules in some email servers. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ exampl.tar.gz.RemoveMe Description: Binary data -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
Beautiful! Thank you Graeme and Mattias and also Juha. So summery is when I have 2 package named clientpkg and serverpkg with shared unit but fist one with graphical dependencies so when I make an server app I should declare for example -ThisIsServer and for client nothing and in code use compiler condition so when ThisIsServer declared I exclude graphical code. Correct and this is the best way? Also I want to ask how can I find out my app is running in non graphical OS?with compiler condition? Regards, Ara -- http://www.fastmail.com - The way an email service should be -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
On Fri, Jun 19, 2015 at 1:17 PM, Graeme Geldenhuys wrote: > From what I understand Project Options can now set values on packages too. > How exactly this is done, I don't know. That is the "Additions and Overrides" you have just discovered. Just put your custom define there and it affects all dependent packages. "Additions and Overrides" is versatile but also complex. The is confusing partly because of the complexity but I think it could be simplified. I have added a separate entry for setting LCLWidgetType because many people did not find it and were asking. Good ideas for the GUI are welcome, for example as mockups. Juha -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
On Fri, 19 Jun 2015 03:22:47 -0700 aradeonas wrote: > Aha! That what I mean,you explained it better than me ;) > > About Compiler Defines,until now I couldn't make them work,I don't know > why! can you show me an simple example? In Project Options / Compiler Options / Additions and Overrides: http://wiki.lazarus.freepascal.org/IDE_Window:_Compiler_Options#Add_a_flag_to_project_and_all_packages In code you can then use: {$IFDEF SomeFlag} {$ELSE} {$ENDIF} > This project going to be big and I want just changing package from > client to server change dependencies and allow me to run app in a non > graphical OS. Mattias -- ___ 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
Re: [Lazarus] Newbie, porting class to FPC but get procedure assignment error
On Fri, 19 Jun 2015 08:55:47 +, Mark Morgan Lloyd 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] Different packages for different usage
Aha! That what I mean,you explained it better than me ;) About Compiler Defines,until now I couldn't make them work,I don't know why! can you show me an simple example? This project going to be big and I want just changing package from client to server change dependencies and allow me to run app in a non graphical OS. Regards, Ara -- http://www.fastmail.com - Send your email first class -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
On 2015-06-18 22:48, aradeonas wrote: > units share with these two package that used TPicture in some parts but > they can be removed with compiler condition. And it still boggles the mind why TPicture (essentially graphic handling) must pull in the whole LCL or VCL. Free Pascal's FCL-Image doesn't require the VCL or LCL, so why must TPicture. I had a similar issue with code I had to work on a year or two ago. Anyway, back to the point at hand... From what I understand Project Options can now set values on packages too. How exactly this is done, I don't know. Maybe the wiki could help. This should mean that if you set a compiler define in your project, that compiler define could be applied to dependency packages too. So your Client app could have the define, and the Server app doesn't. The code in your package then uses simple IFDEF's to block out some parts of the code. I have so many issues with Lazarus Packages these days - I recommend you scrap them completely and simply use IDE Macros. Build settings, Compiler Defines etc are much much easier to handle then. Each project has there own settings and is applied to all the source code involved. 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] Different packages for different usage
Yes I done something like this but didn't like it so much because I dont want to have different class naming,Im looking for a way that just changing some parameter or condition with package do the job. Regards, Ara -- http://www.fastmail.com - Access all of your messages and folders wherever you are -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Different packages for different usage
Am 19.06.2015 10:36 schrieb "aradeonas" : > > Thanks but I cant understand you. > Problem is for example I have a class that will used for server and > client but in client it will do some works with TPicture and in server > there is no need for these functions and property and without them also > class will work but I dont know how separate them so just changing a > package do the job. In that case you should use inheritance. Have a class which does the common part which resides in a shared package. The client package then has a class that extends that shared class with the TPicture related functionality. 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
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
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] I have some custom components, can I convert Delphi -> Lazarus?
Michael Schnell wrote: On 06/18/2015 06:01 PM, Bo Berglund wrote: In the pas file referencing the obj file I have this: IMPLEMENTATION USES Windows; {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } { External functions } FUNCTION RNBOsproFormatPacket( ApiPacket : RB_SPRO_APIPACKET_PTR; thePacketSize : WORD ) : WORD; STDCALL; EXTERNAL; It uses e.g. "STDCALL", so supposedly it is an ANSI C based interface. 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. I can't safely comment on Windows-specific issues, we gave that up years ago (the hassle of accounting for every copy on various experimental machines etc. was more than it was worth). Assuming standard linkage conventions the function should "just work", but the definition of RB_SPRO_APIPACKET_PTR might need checking. But being able to successfully link might not be enough. It might be possible that the Safenet thingy does some encryption with the exe information file to allow only execution only if the correct dongle is found. That might or might not be compatible with fpc generated exes. But as a cautionary tale, a colleague who didn't know x86 assembler once spent many lunchtimes stepping through AutoCAD to break their dongle lookup so that he could do something like running a slightly older (but more comprehensive) version than he'd got a formal license for. "Security by obscurity" doesn't work, particularly on an open system like a PC. -- 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] Different packages for different usage
Thanks but I cant understand you. Problem is for example I have a class that will used for server and client but in client it will do some works with TPicture and in server there is no need for these functions and property and without them also class will work but I dont know how separate them so just changing a package do the job. Regards, Ara -- http://www.fastmail.com - Accessible with your email software or over the web -- ___ 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 09:38:01 +0200, Luca Olivetti 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] I have some custom components, can I convert Delphi -> Lazarus?
On 06/18/2015 09:02 PM, Graeme Geldenhuys wrote: If all else fails with using the .obj file directly with FPC, what about using the .obj file in Delphi and create a DLL, which you can then use from FPC. Could that work? With that cracking the protection would be extremely easy. -Michael -- ___ Lazarus mailing list Lazarus@lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] I have some custom components, can I convert Delphi -> Lazarus?
On 06/18/2015 06:48 PM, Bo Berglund wrote: However, this dongle component can equally well be used without being dropped anywhere "Dropping" is just a design time thingy. any visual component can be used by doing the appropriate initialization code manually. -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
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] I have some custom components, can I convert Delphi -> Lazarus?
On 06/18/2015 06:01 PM, Bo Berglund wrote: In the pas file referencing the obj file I have this: IMPLEMENTATION USES Windows; {$L SPROMEPS.OBJ} { LINK WITH THE SUPERPRO OBJECT FILE } { External functions } FUNCTION RNBOsproFormatPacket( ApiPacket : RB_SPRO_APIPACKET_PTR; thePacketSize : WORD ) : WORD; STDCALL; EXTERNAL; It uses e.g. "STDCALL", so supposedly it is an ANSI C based interface. 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. But being able to successfully link might not be enough. It might be possible that the Safenet thingy does some encryption with the exe information file to allow only execution only if the correct dongle is found. That might or might not be compatible with fpc generated exes. -- ___ 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 "" 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