Re: [fpc-pascal] ExecuteProcess problem
El 25/8/20 a les 14:31, Koenraad Lelong via fpc-pascal ha escrit: Hi, I'm extending an old daemon so it writes the data to MQTT, using mosquitto_pub. Not what you're asking, but did you try to send the messages yourself instead of using mosquitto_pub? I didn't try it, but there's https://github.com/heX16/mqtt-free-pascal Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] stdcall without the ;
Hello, I just compiled a lazarus project made in 2105 with fpc 3.2.0 and, while it works here, it fails when the customer runs it. I noticed that I'm using a dll and the functions and callbacks are declared stdcall (the platform is win32) but without the ;, i.e.: function OnAttach(handle: pointer; userdata: ptrint): Integer stdcall; instead of function CPhidgetInterfaceKit_create(var handle: Pointer):Integer; stdcall; The project compiles fine, could it be that the missing ';' causes the stdcall not to be taken into account? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] stdcall without the ;
But I don't have the hardware managed by the DLL so the callbacks are never called here. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] stdcall without the ;
I did more than that, I created a DLL that simulates the hardware (it's a phidget I/O board) and it works perfectly, both with the old and the new executable. Thank you for the idea. Bye -- Luca 23 sept. 2020 15:33:05 Michael Van Canneyt : > On Wed, 23 Sep 2020, Luca Olivetti via fpc-pascal wrote: > >> But I don't have the hardware managed by the DLL so the callbacks are never >> called here. > > Can't you create a stub DLL to test? it doesn't need to do anything, just log > the params maybe... > > Michael. > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] stdcall without the ;
Nevermind, I checked with -s -a and the generated assembler is the same, with or without the ';' Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] stdcall without the ;
El 23/9/20 a les 17:38, Santiago A. via fpc-pascal ha escrit: El 23/09/2020 a las 13:54, Luca Olivetti via fpc-pascal escribió: Hello, I just compiled a lazarus project made in 2105 with fpc 3.2.0 and, while it works here, it fails when the customer runs it. What does "it fails" mean? Any error message? Sigfault? I'm not at the customer's site, but he told me that it does nothing, it shows nothing and it's not visible in the task manager. What's worse, I have an application exception handler that logs the first unmanaged exception to a file and the halts the program, well, the customer says the file doesn't exist, so I presume there's no unmanaged exception or the application doesn't even reach the handler. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] stdcall without the ;
El 23/9/20 a les 19:45, Luca Olivetti via fpc-pascal ha escrit: El 23/9/20 a les 17:38, Santiago A. via fpc-pascal ha escrit: El 23/09/2020 a las 13:54, Luca Olivetti via fpc-pascal escribió: Hello, I just compiled a lazarus project made in 2105 with fpc 3.2.0 and, while it works here, it fails when the customer runs it. What does "it fails" mean? Any error message? Sigfault? I'm not at the customer's site, but he told me that it does nothing, it shows nothing and it's not visible in the task manager. What's worse, I have an application exception handler that logs the first unmanaged exception to a file and the halts the program, well, the customer says the file doesn't exist, so I presume there's no unmanaged exception or the application doesn't even reach the handler. It turns out everything's fine: I resent the exe, the previous one must have been corrupted in transit. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Adding file to string to the RTL
El 6/10/20 a les 9:01, Michael Van Canneyt via fpc-pascal ha escrit: A simple filecreate, allocate buffer, fileread, fileclose will probably be easiest. Lazarus has a ReadFileToString in fileutil. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] How to get the current translation of a resource string?
Since I want to treat a specific exception that cannot be distinguished by the class alone but only by the class and message, I need to find the current translation of the resource string used to create the exception. The documentation at https://www.freepascal.org/docs-html/current/prog/progse40.html mentions ResourceStringTableCount, ResourceStringCount, GetResourceStringCurrentValue but I can't find them anywhere in my copy of fpc 3.2.0 (they are in fpc 2.6.4 and 3.0.4). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to get the current translation of a resource string?
El 2/12/20 a les 11:49, Michael Van Canneyt via fpc-pascal ha escrit: On Tue, 1 Dec 2020, Luca Olivetti via fpc-pascal wrote: Since I want to treat a specific exception that cannot be distinguished by the class alone but only by the class and message, I need to find the current translation of the resource string used to create the exception. The documentation at https://www.freepascal.org/docs-html/current/prog/progse40.html mentions ResourceStringTableCount, ResourceStringCount, GetResourceStringCurrentValue but I can't find them anywhere in my copy of fpc 3.2.0 (they are in fpc 2.6.4 and 3.0.4). I already did corrections on the documentation for this. But the 'current translation' is simply the value of the resourcestring, so you should not need to look it up ? How? I'm trying to detect this specific exception raise EInvalidOperation.Create(sCannotFocus); (where sCannotFocus is defined in LCLStrConsts). I tried if E is EInvalidOperation then if E.message=sCannotFocus but it doesn't work (sCannotFocus holds the original, not the translated, string). Bye -- Luc< ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to get the current translation of a resource string?
El 2/12/20 a les 13:30, Michael Van Canneyt via fpc-pascal ha escrit: On Wed, 2 Dec 2020, Luca Olivetti via fpc-pascal wrote: But the 'current translation' is simply the value of the resourcestring, so you should not need to look it up ? How? I'm trying to detect this specific exception raise EInvalidOperation.Create(sCannotFocus); (where sCannotFocus is defined in LCLStrConsts). I tried if E is EInvalidOperation then if E.message=sCannotFocus but it doesn't work (sCannotFocus holds the original, not the translated, string). Seems like Lazarus is not using the regular resourcestrings then, because the whole point of using resourcestrings is that their value is the translated value... Never mind, I was fooled by the debugger tool-tip, which shows the original definition and not the current value of the resourcestring :-( Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Initialization of constant record member of pointer type
El 1/12/20 a les 11:00, LacaK via fpc-pascal ha escrit: Thank you, yes it works. I have used: const MyConst1: AnsiString = 'abc' MyConst2: TMyRec = (a: @MyConst1[1]); It doesn't compile with fpc 3.2.0 (I'm trying, without success so far, your open62541 translation). In order to compile your TestOpcUa1 I had to change the definition to MyStructTypeName1 = 'MyStructTypeName';// untyped constant for for Length() MyStructTypeName2: Array[1..length(MyStructTypeName1)] of char = MyStructTypeName1; // typed constant for @ and then use @MyStructTypeName1 (without the [1]) in the record definition. Note that without the [1] it would also compile with an ansistring, but then the pointer wouldn't point at the first character of the string. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] callback from c with varargs
Hello, I'm trying to use a c library where I can define a logging plugin. The c prototype for the callback is void (*log)(void *logContext, UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args); however I couldn't find a way to define a suitable callback in fpc since the "array of const" construct is not allowed with cdecl without external, i.e. procedure LogLog(logContext: Pointer; level: UA_LogLevel; category: UA_LogCategory; msg: PAnsiChar; const args:array of const);cdecl; gives an error "Error: VarArgs directive (or '...' in MacPas) without CDecl/CPPDecl/MWPascal/StdCall and External". I cannot add "external" (I don't want to call an external function, it's the library calling my function) or remove the cdecl (parameter passing wouldn't work then). Is there some trick to define a function with varargs callable from the c library? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] callback from c with varargs
El 19/12/20 a les 23:15, Jonas Maebe via fpc-pascal ha escrit: On 19/12/2020 22:35, Luca Olivetti via fpc-pascal wrote: I'm trying to use a c library where I can define a logging plugin. The c prototype for the callback is void (*log)(void *logContext, UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args); however I couldn't find a way to define a suitable callback in fpc since the "array of const" construct is not allowed with cdecl without external, i.e. It is indeed not possible to implement a function with C varargs in FPC. I was afraid that's the answer :-( as an ugly workaround, I wrote a c library that vsnprintf msg and args to a buffer and then calls a pascal function with no varargs. It works but, as I said, it's ugly and I'd need to provide a .a for every platform I plan to use. Is there a better/simpler way (apart from asking the library developers to use a callback with no varargs)? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Selecting Records with a variable
El 20/12/20 a les 16:02, James Richters via fpc-pascal ha escrit: What I’m hopping to accomplish isn't to get it to work... it's to consolidate a whole bunch of functions and procedures that are all exactly the same except for which axis I am working with... I have 9 possible Axis, X,Y,Z,W,L.R,A,B,C ... Same thing 7 more times ... This is a tedious situation. If I want to change something I have to copy and paste it 9 times then go fix all the variables 9 times.. and it's easy to make a mistake. Then change your data model. Instead of Axis_record = record X,Y,Z,A,B,C: Double; End; use AxisName = (X,Y,Z,A,B,C); Axis_record = array[AxisName] of double; then it's easy to do what you want. procedure DoSomething(var Axis:Axis_record; const which:AxisName); begin Axis[which]:=Axis[which]/2; end; Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] callback from c with varargs
El 20/12/20 a les 14:00, Jonas Maebe via fpc-pascal ha escrit: On 20/12/2020 13:01, Luca Olivetti via fpc-pascal wrote: El 19/12/20 a les 23:15, Jonas Maebe via fpc-pascal ha escrit: It is indeed not possible to implement a function with C varargs in FPC. I was afraid that's the answer :-( as an ugly workaround, I wrote a c library that vsnprintf msg and args to a buffer and then calls a pascal function with no varargs. It works but, as I said, it's ugly and I'd need to provide a .a for every platform I plan to use. Is there a better/simpler way (apart from asking the library developers to use a callback with no varargs)? No. :-( Oh, well, that's life. Now I'm struggling to integrate my stub function under win32 (no problem with linux/64). The linker complains about Error: Undefined symbol: _vsnprintf Error: Undefined symbol: _ua_pascallog the first it's probably because it's missing some library (which?) but the second is defined in my program (and, as I said, it builds and works fine under linux/64) as: procedure ua_pascallog(logContext: Pointer; level: UA_LogLevel; category: UA_LogCategory; msg: PAnsiChar);cdecl;export; Any hint? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)
Hello, I need to tailor the content based on the remote ip address. I use the property RemoteAddr of a TRequest, but sometimes it is empty. I see that it is a header, what I didn't see (yet, I'll trace through the code later) is if it is sent from the remote host or is it filled based on the ip address of the connection. If the former, is there a more reliable way to obtain the connected ip address? If the latter is it a bug? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)
El 7/1/21 a les 16:15, Luca Olivetti via fpc-pascal ha escrit: Hello, I need to tailor the content based on the remote ip address. I use the property RemoteAddr of a TRequest, but sometimes it is empty. I see that it is a header, what I didn't see (yet, I'll trace through the code later) is if it is sent from the remote host or is it filled based on the ip address of the connection. If the former, is there a more reliable way to obtain the connected ip address? If the latter is it a bug? I now see that it set in TFPHTTPConnection.ReadRequestHeaders: Result.RemoteAddress := SocketAddrToString(FSocket.RemoteAddress) In turn SocketAddrToString returns an empty string if the address is ipv6, but in my case it shouldn't be (the clients, firefox under windows 10 uses the ipv4 address of the server and most of the time I get the correct remote address, even from the same client). Another option is that TSocketStream.GetRemoteAddress cannot get the address (if fpGetPeerName fails). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)
El 7/1/21 a les 16:59, Luca Olivetti via fpc-pascal ha escrit: El 7/1/21 a les 16:15, Luca Olivetti via fpc-pascal ha escrit: Hello, I need to tailor the content based on the remote ip address. I use the property RemoteAddr of a TRequest, but sometimes it is empty. I see that it is a header, what I didn't see (yet, I'll trace through the code later) is if it is sent from the remote host or is it filled based on the ip address of the connection. If the former, is there a more reliable way to obtain the connected ip address? If the latter is it a bug? I now see that it set in TFPHTTPConnection.ReadRequestHeaders: Result.RemoteAddress := SocketAddrToString(FSocket.RemoteAddress) In turn SocketAddrToString returns an empty string if the address is ipv6, but in my case it shouldn't be (the clients, firefox under windows 10 uses the ipv4 address of the server and most of the time I get the correct remote address, even from the same client). Besides, it seems that the server only listens on ipv4. I'm puzzled, I really can't see where this empty RemoteAddress could come from. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)
El 8/1/21 a les 11:06, Michael Van Canneyt via fpc-pascal ha escrit: Are you using https ? No, plain text http. An even weirder fact is that I seem to get the wrong ip address (i.e. the address of a different client). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)
El 8/1/21 a les 11:14, Luca Olivetti via fpc-pascal ha escrit: El 8/1/21 a les 11:06, Michael Van Canneyt via fpc-pascal ha escrit: Are you using https ? No, plain text http. An even weirder fact is that I seem to get the wrong ip address (i.e. the address of a different client). I think I found the possible cause: I have an own thread that spawns a TEmbeddedHttpServer (actually a derived class to manage server-sent-events, https://lists.lazarus-ide.org/pipermail/lazarus/2020-June/238072.html) with threaded:=true. My thread has a method to manage the requests and it does this FRequest:=ARequest; Synchronize(@SyncNewConnection); if FCommandQueue<>nil then . I think that, since the method is called from a different thread for each request, if two requests come at the same time, the FRequest and/or the FCommandQueue (which is set in the synchronized method) could get mixed up. I now did 2 things: 1) protected that part of the code with a critical section 2) use TThread.Synchronize(nil,..) (since it's not my thread but another one FCrit.Acquire; FRequest:=ARequest; TThread.Synchronize(nil,@SyncNewConnection); LocCommandQueue:=FCommandQueue; FCrit.Release; if LocCommandQueue<>nil then... WDYT? Am I right thinking that, even if several copies of the above method are running, each will get it's own local variables, so the LocCommandQueue variable (as well as the other locals) won't be clobbered by another copy? Or should I declare them as threadvar? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fcl-web: Trequest.RemoteAddr is empty (sometimes)
El 12/1/21 a les 10:24, Michael Van Canneyt via fpc-pascal ha escrit: Am I right thinking that, even if several copies of the above method are running, each will get it's own local variables, so the LocCommandQueue variable (as well as the other locals) won't be clobbered by another copy? Or should I declare them as threadvar? If FCommandQueue is the only thing that is set during SyncNewConnection based on TRequest, then yes. yes to "each will get its [*] own local" or yes to "should I declare them as threadvar"? For safety, I would Nil the FCommandQueue after assigning it to locCommandQueue. No need, it's only used as a return value from the synchronized method. [*] sorry for the "it's" in the original sentence Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Dependency of OpenSSL 1.0.2 still in FPC 3.2.0 on some platforms?
El 6/6/21 a les 8:58, gebylist via fpc-pascal ha escrit: Just place Synapse's sources somewhere, where your project "see it". That's what a lazarus' package does. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to check if a network is available?
El 20/6/21 a les 19:38, Jean SUZINEAU via fpc-pascal ha escrit: Ping uses ICMP protocol. I don't have currently Indy installed on my machines, but I think you can find pascal components for ICMP client and even ICMP server. I think that this way you can do a single "ping", a single ICMP request. It seems that Synapse has ping support too: https://wiki.freepascal.org/Networking_libraries Beware though: under raw socket access (needed for ICMP) is a privileged operation. In older systems the ping executable was setuid root, nowadays it has the cap_net_raw capability. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to get fpc and lazarus sources when svn has shut down?
El 12/8/21 a les 9:59, Martin Frb via fpc-pascal ha escrit: If you have size restrictions, and can't do a full clone, you need a special translation (which you have to find, somewhere in a large manual). https://xkcd.com/1597/ SCNR ;-) (OTOH that could be said also for svn, mercurial, etc.) Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inactive account on GitLab
El 10/9/21 a les 8:12, Michael Van Canneyt via fpc-pascal ha escrit: Then it means the FPC issues should appear in your gitlab todo list. I don't know if is there something wrong or I just don't know how to use gitlab: I have reported some bugs, e.g. https://gitlab.com/freepascal.org/fpc/source/-/issues/37370 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/38100 my gitlab username appears in the "Original reporter info from mantis" however my todo list is empty and if I search for issues I am the author, it doesn't list any fpc/lazarus bugs. https://gitlab.com/dashboard/issues?scope=all&state=all&author_username=olivluca Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inactive account on GitLab
El 10/9/21 a les 9:39, Luca Olivetti via fpc-pascal ha escrit: El 10/9/21 a les 8:12, Michael Van Canneyt via fpc-pascal ha escrit: Then it means the FPC issues should appear in your gitlab todo list. I don't know if is there something wrong or I just don't know how to use gitlab: I have reported some bugs, e.g. https://gitlab.com/freepascal.org/fpc/source/-/issues/37370 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/38100 my gitlab username appears in the "Original reporter info from mantis" however my todo list is empty and if I search for issues I am the author, it doesn't list any fpc/lazarus bugs. https://gitlab.com/dashboard/issues?scope=all&state=all&author_username=olivluca This one works though https://gitlab.com/dashboard/issues?scope=all&state=all&search=%40olivluca but I guess if one has a common word as a username it would get too many results (or none at all: I tried but it gave me a 500 server error) Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Inactive account on GitLab
El 10/9/21 a les 10:21, Michael Van Canneyt via fpc-pascal ha escrit: https://gitlab.com/dashboard/issues?scope=all&state=all&author_username=olivluca This one works though https://gitlab.com/dashboard/issues?scope=all&state=all&search=%40olivluca I see you are referenced in many issues, and the link is 'active'. So I would expect the issues should somehow show up in your profile: activity, todo etc. Maybe you need to star ('favourite') the FPC project for them to appear. I starred the projects of those bugs (FPC/FPC/Source and FPC/Lazarus/Lazarus) but my todo list is still empty. Not a biggie now that I know how to find my bugs, though I'd prefer to find them with the proper filter (the first one with author_username) and not with a full text search. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting Last User Input reliably
El 3/12/21 a les 14:52, James Richters via fpc-pascal ha escrit: I'm trying to get the time lapsed since the last user input with keyboard or mouse on a Windows PC. For this I am doing: GetLastInputInfo(Last_Input_Info); IdleTime:= (GetTickCount - Last_Input_Info.dwTime) DIV 1000; I was going to suggest IdleTime:= DWORD(GetTickCount - Last_Input_Info.dwTime) DIV 1000; but then I saw On top of all this, I need to allow for the possibility that there was no user input for more than 25 days.. which is quite likely. so that's not going to work, sorry. I'm using the above for short intervals and it works in spite of the rollover (unless you enabled overflow checking, but that's another issue). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting Last User Input reliably
El 3/12/21 a les 16:41, Travis Siegel via fpc-pascal ha escrit: If there's some sort of a configuration file, just write out the time/date info at the time of leaving the input, then when that routine gets called again, grab the current time/date, and perform a comparison. That should allow you to bypass any roll overs of any kind (unless it goes past the operating system's time keeping abilities), which isn't likely. I suppose he wants to check for any activity, not just for input directed at his application. One possibility is to have a thread calling GetLastInputInfo cyclically (say, every second or every half second), if the dwTime changed just register the current GetTickCount64 as the time of the input. That should work unless the new input happens exactly after 49.7 days (that's the rollover time, not 25 days) from the last one, at the same, exact, millisecond. Quite improbable but not impossible. Oh, and keep in mind that in older versions of windows there's no GetTickCount64, the rtl simulates it by using.GetTickCount. Windows Vista and above should be fine though. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Getting Last User Input reliably
El 3/12/21 a les 18:37, Dennis Lee Bieber via fpc-pascal ha escrit: Detection is normally done by: if current tick is less than saved tick, roll-over has occurred. Make adjustments to the delta. There is no need to do that, just make sure you're using DWORDs (i.e. unsigned arithmetic) everywhere and disable overflow checking. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] no array support in sqldb/sqldbrestbridge?
llo, since I'm going to need arrays in a postgresql database to expose via a rest api, I did a simple test with sqldbrestbridge. I created a simple table: create table prueba (x integer not null, y integer[]); insert into prueba values (1, '{2,3}'); then I exposed it with sqlrestdb: FDisp:=TSQLDBRestDispatcher.Create(Self) FDisp.ExposeDatabase('postgresql','host','database','user','password'); FDisp.Active:=true; and when I browse the database I only see the x field: { "metaData" : { "fields" : [ { "name" : "x", "type" : "int" } ] }, "data" : [ { "x" : 1 } ] } So, is there no array field support in sqldb and/or in sqldbrestbridge? I dropped a TSQLQuery on a form and I could define both fields, but "y" was just a plain TField (i.e. it was not mapped to an array field, in fact I could not find definitions of array fields in DB.pas, apart from the ftArray constant in TFieldType). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] no array support in sqldb/sqldbrestbridge?
El 7/6/22 a les 14:15, LacaK via fpc-pascal ha escrit: Hi, So, is there no array field support in sqldb and/or in sqldbrestbridge? there was added into DB.pas : TObjectField and TArrayField https://gitlab.com/freepascal.org/fpc/source/-/blob/main/packages/fcl-db/src/base/db.pas but implementation is incomplete. Methods in fields.inc are empty. Also in TSQLConnection descendants (like TPQConnection) there is no support. Oh, well, in the meantime I discovered postgREST so that's not an issue anymore. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is there any benefit for a Delphi/Free Pascal/Lazarus programmer to build a C DLL in debug mode ?
El 29/8/22 a les 9:50, Skybuck Flying via fpc-pascal ha escrit: Is there any benefit for a Delphi or Free Pascal/Lazarus programmer to build a C DLL in debug mode ? yes, because I found out that you can debug it right inside lazarus, almost like pascal code. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] reading a TFPGMap from several threads
Hello, I have a couple of TFPGMaps that I populate once and never change. Is it safe to read them (i.e. use Find and Data[]) from different threads? I'd avoid using a critical section if not absolutely necessary. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] reading a TFPGMap from several threads
El 7/9/22 a les 14:12, Sven Barth via fpc-pascal ha escrit: Luca Olivetti via fpc-pascal <mailto:fpc-pascal@lists.freepascal.org>> schrieb am Mi., 7. Sep. 2022, 13:01: Hello, I have a couple of TFPGMaps that I populate once and never change. Is it safe to read them (i.e. use Find and Data[]) from different threads? I'd avoid using a critical section if not absolutely necessary. I'd say that this should be safe indeed. Ok, thank you. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Access Violation When SetLength(DynArray, Value)
El 8/9/22 a les 16:53, Anthony Walter via fpc-pascal ha escrit: > curious minds want to know: what was the fix? In a separate part of the pool table initialization, I was precalculating the midpoints and normals for bumper rails. I had carelessly written this code: for I := 0 to Length(Rails) do RailInit(Rails[I], I); To avoid this kind of error you can use for i:= 0 to High(Rails) do or even for i:= Low(Rails) to High(Rails) do Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TJSONRPCModule: access the request from an handler.
Hello, I added a "Web JSON-RPC Module" to my project, I dropped on it a TJSONPCHandler. I find no way to access the request (I want to check the RemoteAddress): 1) the module has a "Request" field but it is always nil (either in DataModuleCreate, which isn't called with every request so it's unusable anyway, in BeforeExecute and in Execute, I didn't check AfterExecute but it would be too late). 2) the JSONRPCHandler has no way to access the request (or I couldn't find it). I guess that, instead of calling the RegisterHTTPModule of the module, I should register the route in my webserver class (with httprouter.RegisterRoute), but what should I do in the handler to delegate the handling to the JSONRPCModule? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Access Violation When SetLength(DynArray, Value)
El 9/9/22 a les 14:58, James Richters via fpc-pascal ha escrit: Is there some nifty way to increase a dynamic array by 1 that is more elegant? Inc(MyArray); would sure be nice If I know that I have to regularly add a single element to an array, instead of using a dynamic array I just use a TFPGList (if the elements are simple types or records) or a TFPGObjectList (if the element are objects and I want automatic housekeeping) from the fgl unit, then I can just do MyList.Add(element). I don't know if it is more or less efficient than using a dynamic array but I think it's nicer. There are other generic classes that may be more efficient than fgl but I'm just used to fgl. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TJSONRPCModule: access the request from an handler.
El 9/9/22 a les 15:50, Michael Van Canneyt ha escrit: The solution is much more simple. Override HandleRequest() in the module. Save the request in a variable and call inherited. Much simpler indeed! Thank you. In my case I just save the remote address, but in your example below I suppose you redefined FRequest (and FResponse) to hide the private one in the ancestor, but what I don't understand is the C:=C+C and the need to set FRequest and FResponse to nil. I have code that needs to work with 3.2.2 and I do this: --- procedure TUserRPCModule.HandleRequest(ARequest: TRequest; AResponse: TResponse); Var C : String; begin FRequest:=aRequest; FResponse:=aResponse; try C:=FRequest.Content; C:=C+C; inherited HandleRequest(ARequest, AResponse); finally FRequest:=Nil; FResponse:=Nil; end; end; Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] fpwebfile, indexPageName and query -> 404
Hello, if I request, e.g. http://localhost:8080 or http://localhost:8080/ fpwebfile returns the document defined as IndexPageName (in my case index.html), but if I request http://localhost:8080?xxx or http://localhost:8080/?xxx I get a 404. That's because TCustomFileModule.GetRequestFIleName with an empty PathInfo uses the URI and thinks that the filename is ?xxx. Maybe the if (Result='') then Result:=ARequest.URI; should be eliminated? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpwebfile, indexPageName and query -> 404
El 13/9/22 a les 16:28, Michael Van Canneyt via fpc-pascal ha escrit: On Tue, 13 Sep 2022, Luca Olivetti via fpc-pascal wrote: Hello, if I request, e.g. http://localhost:8080 or http://localhost:8080/ fpwebfile returns the document defined as IndexPageName (in my case index.html), but if I request http://localhost:8080?xxx or http://localhost:8080/?xxx I get a 404. That's because TCustomFileModule.GetRequestFIleName with an empty PathInfo uses the URI and thinks that the filename is ?xxx. Maybe the if (Result='') then Result:=ARequest.URI; should be eliminated? No, it needs to strip the query parameter. But that's already in PathInfo: procedure ParseStartLine(Request : TFPHTTPConnectionRequest; AStartLine : String); Function GetNextWord(Var S : String) : string; Var P : Integer; begin P:=Pos(' ',S); If (P=0) then P:=Length(S)+1; Result:=Copy(S,1,P-1); Delete(S,1,P); end; Var S : String; I : Integer; begin if aStartLine='' then exit; Request.Method:=GetNextWord(AStartLine); Request.URL:=GetNextWord(AStartLine); S:=Request.URL; I:=Pos('?',S); if (I>0) then S:=Copy(S,1,I-1); If (Length(S)>1) and (S[1]<>'/') then S:='/'+S else if S='/' then S:=''; Request.PathInfo:=S; <<<<<<<<<<<< Bye -- Luca Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JSON RPC changes in 3.3.1
El 28/9/22 a les 3:06, Hairy Pixels via fpc-pascal ha escrit: :: <~~ pascal-language-server 6: {'message': 'Parameters must be passed in an object or an array.', 'code': -32602} Maybe related to this? https://lists.freepascal.org/pipermail/pas2js/2022-September/00.html (though I'm getting it with 3.2.2). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] JSON RPC changes in 3.3.1
El 28/9/22 a les 8:51, Hairy Pixels via fpc-pascal ha escrit: On Sep 28, 2022, at 1:34 PM, Luca Olivetti via fpc-pascal wrote: Maybe related to this? https://lists.freepascal.org/pipermail/pas2js/2022-September/00.html The question then is did they change something in 3.3.1 in regards to how parameters can be sent? The error "Parameters must be passed in an object or an array.” Suggests maybe I was sending the params as some other type and this is now illegal in 3.3.1. In my case there was no parameter at all (since it was an empty array), which is either a fault of the client library (pas2js) or of the server (which should not consider it as an error if the method needs no parameters). For the time being I modified my code to send a dummy parameter. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Why TSqlScript has no parameters?
Hello, I need to execute more than one statement. TSqlQuery it seems to accept multiple statements but then it gives a strange error (posgtresql error "no parameter $2", the parameter it refers to is defined and used in the second statement). So I tried a TSQlScript but then I could find no way to pass parameters. I'm used to the zeos components and its TZSQLProcessor (rough equivalent of TSqlScript) has parameters just like a query. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Why TSqlScript has no parameters?
El 10/10/22 a les 19:30, Michael Van Canneyt via fpc-pascal ha escrit: This feature is missing in TSQLScript, because I never needed it, but it should be easy enough to add. No, don't bother, it's just two statements and I can simply use TPQConnection.ExecuteDirect (in fact that's what I'm using). I just wanted to know if I missed something. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
Hello, I'm using a TFPHTTPServerHandler in threaded mode. I'm also using a TJSONRpcModule. I see that, even if the calls come from different threads, only one instance of the rpc module is ever created (on demand, the first time an rpc request comes in) and used. Since I'm relying on this behaviour, can I be 100% sure it's by design and not a quirk of my test setup? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
El 21/10/22 a les 9:39, Michael Van Canneyt via fpc-pascal ha escrit: And a property of your module: property Kind: TWebModuleKind read FWebModuleKind write FWebModuleKind default wkPooled; wkPooled is the default, but if you explicitly set this to 'wkPooled' in the constructor, you'll be sure there is only ever 1 instance of the module, which is reused for every request... Thank you, I see that the property isn't published, so it's not available in the object inspector. Can I set it in the DataModuleCreate os is it too late? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
El 21/10/22 a les 9:48, Luca Olivetti via fpc-pascal ha escrit: El 21/10/22 a les 9:39, Michael Van Canneyt via fpc-pascal ha escrit: And a property of your module: property Kind: TWebModuleKind read FWebModuleKind write FWebModuleKind default wkPooled; wkPooled is the default, but if you explicitly set this to 'wkPooled' in the constructor, you'll be sure there is only ever 1 instance of the module, which is reused for every request... Thank you, I see that the property isn't published, so it's not available in the object inspector. Can I set it in the DataModuleCreate os is it too late? I overrode the CreateNew method, I hope that's enough. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
El 21/10/22 a les 9:57, Luca Olivetti via fpc-pascal ha escrit: El 21/10/22 a les 9:48, Luca Olivetti via fpc-pascal ha escrit: El 21/10/22 a les 9:39, Michael Van Canneyt via fpc-pascal ha escrit: And a property of your module: property Kind: TWebModuleKind read FWebModuleKind write FWebModuleKind default wkPooled; wkPooled is the default, but if you explicitly set this to 'wkPooled' in the constructor, you'll be sure there is only ever 1 instance of the module, which is reused for every request... Thank you, I see that the property isn't published, so it's not available in the object inspector. Can I set it in the DataModuleCreate os is it too late? I overrode the CreateNew method, I hope that's enough. I see that Kind is used after the module has been created, so setting it in either method (CreateNew or DataModuleCreate) should be OK, am I right? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
El 21/10/22 a les 12:48, Michael Van Canneyt via fpc-pascal ha escrit: I see that Kind is used after the module has been created, so setting it in either method (CreateNew or DataModuleCreate) should be OK, am I right? You are right. I will publish the method. That's an oversight. Meanwhile I changed the method I use to route the calls to the main thread (Application.QueueAsyncCall instead of a critical section and Synchronize) so it doesn't matter any more if there is just one instance or more than one. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
El 21/10/22 a les 17:09, Luca Olivetti via fpc-pascal ha escrit: El 21/10/22 a les 12:48, Michael Van Canneyt via fpc-pascal ha escrit: I see that Kind is used after the module has been created, so setting it in either method (CreateNew or DataModuleCreate) should be OK, am I right? You are right. I will publish the method. That's an oversight. Meanwhile I changed the method I use to route the calls to the main thread (Application.QueueAsyncCall instead of a critical section and Synchronize) so it doesn't matter any more if there is just one instance or more than one. Now that I think of it, even with the previous method it wouldn't have mattered (since each instance would have been using its own critical section and other fields). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Can't build single package
IIRC I did it in the past but now: D:\fpc-3.2.2\packages\fcl-web>make C:/FPC/3.2.2/bin/i386-Win32/ppc386.exe fpmake.pp -n -Fu../../rtl -Fu../../packages/paszlib -Fu../../packages/fcl-process -Fu../../packages/hash -Fu../../packages/libtar -Fu../../packages/fpmkunit/units_bs/i386-win32 Fatal: Can't find unit system used by fpmake Fatal: Compilation aborted make: *** [fpmake.exe] Error 1 D:\fpc-3.2.2\packages\fcl-web>fpc fpmake.pp Free Pascal Compiler version 3.2.2 [2021/05/15] for i386 Copyright (c) 1993-2021 by Florian Klaempfl and others Target OS: Win32 for i386 Compiling fpmake.pp Linking fpmake.exe 438 lines compiled, 0.3 sec, 330944 bytes code, 15364 bytes data D:\fpc-3.2.2\packages\fcl-web>make ./fpmake.exe compile --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i386 -o -di386 --compiler=C:/FPC/3.2.2/bin/i386-Win32/ppc386.exe -bu The installer encountered the following error: Could not find unit directory for dependency package "rtl" required for package "fcl-web" make: *** [all] Error 1 Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't build single package
El 2/11/22 a les 9:37, Luca Olivetti via fpc-pascal ha escrit: IIRC I did it in the past but now: D:\fpc-3.2.2\packages\fcl-web>make C:/FPC/3.2.2/bin/i386-Win32/ppc386.exe fpmake.pp -n -Fu../../rtl -Fu../../packages/paszlib -Fu../../packages/fcl-process -Fu../../packages/hash -Fu../../packages/libtar -Fu../../packages/fpmkunit/units_bs/i386-win32 Fatal: Can't find unit system used by fpmake Fatal: Compilation aborted make: *** [fpmake.exe] Error 1 OK, the problem is that I installed the compiler with the windows installer and the makefile expects it to be in its tree (hence the "-n" and the "-Fu" options). Is there something I can do (other than building and installing the compiler from the source tree)? Bye -- LUca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't build single package
El 2/11/22 a les 15:54, Tomas Hajny via fpc-pascal ha escrit: OK, the problem is that I installed the compiler with the windows installer and the makefile expects it to be in its tree (hence the "-n" and the "-Fu" options). Is there something I can do (other than building and installing the compiler from the source tree)? This is not matter of the compiler location (the current directory is the location where you started make.exe). However, you are supposed to have the packages sources together with the rtl sources. The location where you start make seems to be the directory of compiled fcl-web package rather than the directory with the respective sources. Did you copy the fcl-web sources there manually? No, in fact "make clean; make" under linux, with the same tree(*), works: luca@seis:~/Datos/fpc-3.2.2/packages/fcl-web$ make clean ; make ./fpmake clean --localunitdir=../.. --globalunitdir=.. --os=linux --cpu=x86_64 -o -Cg -o -dx86_64 --compiler=/usr/local/bin/ppcx64 -bu ./fpmake compile --localunitdir=../.. --globalunitdir=.. --os=linux --cpu=x86_64 -o -Cg -o -dx86_64 --compiler=/usr/local/bin/ppcx64 -bu Start compiling package fcl-web for target x86_64-linux. Compiling BuildUnit_fcl_web.pp Compiling ./src/base/fpmimetypes.pp Compiling ./src/base/httpprotocol.pp . Compiling ./src/restbridge/sqldbrestauthini.pp Compiling ./src/restbridge/sqldbrestmodule.pp [100%] Compiled package fcl-web The difference is that under Linux I built and installed fpc from that tree, but there are no compiled units for windows there (only the sources). (*) when I say "the same" I mean "the same", i.e. linux is the host and windows is a guest VM with the "~/Datos" directory mapped as network drive D: Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't build single package
El 2/11/22 a les 17:06, Tomas Hajny via fpc-pascal ha escrit: I see. This means that you already have the prerequisites fulfilled in the source tree for Linux, but not for Windows. Start by issuing 'make rtl_all packages_all' in D:\fpc-3.2.2. Then try rebuilding fcl-web in the fcl-web directory - I believe that it might work then. Yes, that worked, but then it caused another problem: I wanted to recompile fcl-web because I couldn't install the lazsqldbrest package Compile package sqldbrestschemadesigner 0.0: Exit code 1, Errors: 1, Warnings: 1 Warning: Recompiling sqldbrestmodule, checksum changed for C:\FPC\3.2.2\units\i386-win32\fcl-web\fphttp.ppu build304.pp(19,58) Fatal: Cannot find sqldbrestmodule used by build304. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=C:\FPC\3.2.2\units\i386-win32\fcl-web\sqldbrestmodule.ppu.. Most probably because I modified some units to correct a couple of bugs. Now, after "make rtl_all packages_all" and copying the fcl-web units to the correct location, I get this Compile package sqldbrestschemadesigner 0.0: Exit code 1, Errors: 1, Warnings: 1 Warning: Recompiling sqldbrestschema, checksum changed for C:\FPC\3.2.2\units\i386-win32\rtl\classes.ppu sqldbrestschema.pp(13,55) Fatal: Can't find unit sqldbrestschema used by dlgrestfieldoptions Might as well build and install fpc from source :-/ Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Can't build single package
El 3/11/22 a les 9:31, Tomas Hajny via fpc-pascal ha escrit: Might as well build and install fpc from source :-/ That's always an option, of course. ;-) For the record (and for my memory, since I'm sure I'll forget), I almost did that (i.e. make rtl_install, make packages_install then copied the resulting units from d: to c:). Probably installing fpc completely would have been less effort :-D However, I guess that it would also help to run 'make rtl_clean packages_clean rtl_all packages_all' or even 'make distclean rtl_all packages_all'. Did you combine compilation using an IDE (e.g. Lazarus) with compilation using makefiles? That may easily lead to problems (especially due to compiled files being placed in locations not expected by the makefiles, thus resulting in multiple compiled versions of the same unit in different places)... No, I just use lazarus to install its packages (in fact lazsqldbrest was already installed in lazarus 2.2.2, but I had to uninstall it in order to compile lazarus 2.2.4: since I had modified the units in fcl-web the old lazarus was still working but the new one wouldn't compile). It doesn't help though that, in a futile attempt to avoid useless recompilations, I have this as a global lazarus "Additions and Overrides": OutDir -> lib/$(PkgName)/$(FPCVer)/$(TargetCPU)-$(TargetOS)/$(BuildMode) Anyway, for the time being, issue solved. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] TSQLQuery doesn't work with a lookup field if it is a memo (text)
Hello, I just found out that if I try to create a lookup field that points to a memo field (in postgresql the field is defined as text), it bombs out with "list index (-2) out of tange" (or a similar message). It seems it is because a TMemo lookup field is assigned -1 as its index. TO solve the issue I just cast the field in the query to a varchar(100), but, FYT, TZQuery (zeos) has no problem with that (but in this project I'm using sqldb). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TSQLQuery doesn't work with a lookup field if it is a memo (text)
El 13/1/23 a les 16:54, Luca Olivetti via fpc-pascal ha escrit: TO solve the issue I just cast the field in the query to a varchar(100), but, FYT, TZQuery (zeos) has no problem with that (but in this project I'm using sqldb). That was meant to be "FYI" :-/ Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] heaptrc under linux points to the wrong line
Hello, as per the subject, with heaptrc enabled, output to a file and using the "view leaks and traces" feature of lazarus, I see several leaks, always on the same line. However, under linux 64 bits, the line it points to is not where the leak is created. Linux was reporting the leak in this function function TSseResponse.Send(const command:TDisplayCommand):boolean; const eventstring='event:'; datastring='data:'; var cmd: TSseCommand; begin if command=nil then begin cmd.event:=''; cmd.data:=''; end else cmd:=command.GetCommand; <--- here TSseCommand is declared as TSseCommand = record event,data:string; end; I compile the same project under windows (32 bits) and there I see the real location of the leak: inside the "GetCommand" method of one of the classes derived from TDisplayCommand. Fpc 3.2.2, lazarus 2.2.6, debug info automatic (-g) and using the external debug symbols file (-Xg). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Need some advice
El 24/1/24 a les 20:31, ppadilcdx via fpc-pascal ha escrit: Trying to use the fgl unit, specifically the TFPGMap. Below is a simple program I'm trying to compile; it gives me two errors: fgl.pp(1582,18) Error: Operator is not overloaded: "pair" < "pair" fgl.pp(1584,23) Error: Operator is not overloaded: "pair" > "pair" add a {$Modeswitch advancedrecords} and use class operators program test; {$mode objfpc} {$modeswitch advancedrecords} uses fgl; type pair = record x, y : integer; class operator < (a,b:pair):boolean; class operator > (a,b:pair):boolean; end; operator < (a,b: pair) r:boolean; class operator pair.<(a,b:pair):boolean; begin if a.x < a.y then r := true result:=true else r := false; result:=false; end; bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] opening a serial port in a dll called from dot net fails
I'm writing a dll that is used by a dot net application (32bits). If I call SerOpen in the initialization section of the dll there is no problem, but if I call it from one of the exported functions it gives me an access denied (GetLastError gives me a 5), and I really need to call it from a function (due to some quirks in the calling program which is not under my control). A search in the usual places tells me that in dot net opening a serial port with CreateFile (which is what SerOpen does) is forbidden, that you should use the SerialPort class (which I don't think I can do from my dll written in freepascal). Is there any way to solve my problem? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] opening a serial port in a dll called from dot net fails
El 9/3/24 a les 16:24, Luca Olivetti via fpc-pascal ha escrit: Never mind, I put the serial port access in a separate exe and the dll communicates with it via an udp socket. I'd still like to know why I got an access denied when trying to open the port from an exported procedure, typical ms bullshit or another case of pebkac? Bye I'm writing a dll that is used by a dot net application (32bits). If I call SerOpen in the initialization section of the dll there is no problem, but if I call it from one of the exported functions it gives me an access denied (GetLastError gives me a 5), and I really need to call it from a function (due to some quirks in the calling program which is not under my control). A search in the usual places tells me that in dot net opening a serial port with CreateFile (which is what SerOpen does) is forbidden, that you should use the SerialPort class (which I don't think I can do from my dll written in freepascal). Is there any way to solve my problem? Bye ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] opening a serial port in a dll called from dot net fails
El 11/3/24 a les 11:38, Elmar Haneke via fpc-pascal ha escrit: Presumably the problem is caused by calling your function from a different thread. Perhaps it is a solution to put the SerOpen in a thread created by FPC and signal that thread from your dot-net-called function. Nope, I tried, same error. Am 09.03.24 um 16:24 schrieb Luca Olivetti via fpc-pascal: I'm writing a dll that is used by a dot net application (32bits). If I call SerOpen in the initialization section of the dll there is no problem, but if I call it from one of the exported functions it gives me an access denied (GetLastError gives me a 5), and I really need to call it from a function (due to some quirks in the calling program which is not under my control). A search in the usual places tells me that in dot net opening a serial port with CreateFile (which is what SerOpen does) is forbidden, that you should use the SerialPort class (which I don't think I can do from my dll written in freepascal). Is there any way to solve my problem? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Signing applications, how?
El 10/8/24 a les 11:28, Jeppe Johansen via fpc-pascal ha escrit: It's fairly straight-forward to use this on executables. You point it at the EXE and the code signing certificate you will use. I guess you'll have to get ($$$) a valid signing certificate too. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Signing applications, how?
El 10/8/24 a les 15:32, Bo Berglund via fpc-pascal ha escrit: On Sat, 10 Aug 2024 13:32:12 +0200, Luca Olivetti via fpc-pascal wrote: El 10/8/24 a les 11:28, Jeppe Johansen via fpc-pascal ha escrit: It's fairly straight-forward to use this on executables. You point it at the EXE and the code signing certificate you will use. I guess you'll have to get ($$$) a valid signing certificate too. Can I use LetsEncrypt certificates or must I cash out big to get a working one? I'm not sure but I fear the latter. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal