Jump to content

Sonjli

Members
  • Content Count

    28
  • Joined

  • Last visited

Community Reputation

1 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ok,I tried but they are all ok...
  2. sorry... what!? I have the register only on frames, not on TdataModules, am I wrong?
  3. Ciao Uwe, I try asap... never touched the dproj :B thanks
  4. Sorry @Kas Ob. but my problem is at designtime, not runtime. The problem happens in IDE. thanks.
  5. My dpr is not exactly canonical... so, is there any problem with IDE ancestor resolution and "strange" disposition of dpr code? For example I have a wrapper object for "Application", so there is no standard Application.createForm(); Application.Initialize; Application.Run; Can this be a problem? I didn't try to make a cosole app (my apps are similar to console applications) with my datamodules, in fact... I can try
  6. Everything is exactly as you write. Every datamodule is correctly declared in dpr with path and comment. Real code: ... UInterfacedDataModule in '..\..\..\Model\UInterfacedDataModule.pas' {DMInterfacedDatamodule: TDataModule}, UDMCustomModel in '..\..\..\UDMCustomModel.pas' {DMCustomModel: TDataModule}, UDMUniModel in '..\..\..\Model\UniModel\UDMUniModel.pas' {DMUniModel: TDataModule}, ...
  7. Hi all, I perfectly know the error in subject. It is due of an ancestor form\datamodule missing in the project (don't go deep in all other sub-cases this error can happen...). In my dpr I have all of the ancestors, and if I open them in IDE in the correct order (grandfather - father - child) everything is fine. BUT if I open only a "child" then this error happens. My project is a bit complicated (I make use of injection, threads, etc.) but this simple error is making me and my team crazy. Any idea how to solve this situation? The object tree is something like: TBaseDatamodule |- TChildDatamodule |-- TConcreteDatamodule Thanks in advance, Eddy
  8. Sonjli

    Scheduled tasks at system time

    Because I need to be in strict control with the scheduling and I am in cross development (Linux and Windows at least). Interesting... any example? I know I can do something like this in OTL, so a "standard" example could help me to figure out.
  9. Hi, I need to schedule some actions when the time arrives. Something like Windows scheduler does. For example at 12.00am of every day I have to post a rest call on a web site, or at 2.00pm another task. I know it is simple to do it with a standard timer or a polling on system time, but is there a smart solution with OTL? Thanks in advance.
  10. Hi, I have this case where one OmniTask run some external code from a delphi library\Component that uses internally a TThread. This thread can't be accessed from outside. This external library have a class which listen for an incoming request and when this happens then it run a "onReceive" event. Something like a listening socket. One OmniTask "run" one and only one of these objects. Have I to pay attention when the "inside-thread" have to use write-resources of the Omnitask? For example when the "inside-thread" need to use the logger of the OmniTask? Some pseudo code: CreateTask( procedure(const task: IOmniTask) var lBroadcaster: IBroadcastManager; lLogger: ILogWriter; begin [...] task.Lock.Acquire; try lLogger.Log(TLogType.Info, 'Testing...', 'TEST'); finally task.Lock.release; end; [...] // lBroadcaster is the object using an internal tthread lBroadcaster.OnReceive := procedure(ABroadcastMessage: IBroadcastMessage) begin task.Lock.Acquire; try try lLogger.Log(TLogType.Info, 'Parsing...', 'TEST'); [...] except on E: Exception do begin lLogger.Log(TLogType.Error, 'Exception (%s): "%s"', [E.ClassName, E.Message], 'TEST'); end; end; finally task.Lock.release; end; end; lBroadcaster.Connect('127.0.0.1', 'guest', 'guest', True); ).SetParameter([...]) // All my stuff injiections .WithLock(CreateOmniCriticalSection) .Run; Is the locking mechanism used in the right way? Thanks Eddy
  11. The API is documented and I used it for years. The my only problem is about pointers... I know, don't say a word 😉 Do you have any Pascal related documentation\manual about pointers? Thanks everybody. Eddy
  12. Thank you Anders, really precious. As you see I use the FOCAS library to connect some CNC and sometimes there are some traps... Are you skilled with FOCAS? May I ask you any questions sometimes if I am in danger? 😅
  13. Hi Cristian, thanks for your answer. How do I allocate popmsg? How do I dispose the array? How do I read an element? @popmsg[4].alm_no or popmsg[4]^.alm_no? Eddy
  14. Hi guys, I hope this is the right topic to place my doubts. I use a DLL written in C and it need some work with pointers. I admit I am not very prepared with pointers (scholastic remembrances), so I hope my question to be clear. I have this structure: PODBALMMSG2 = ^ODBALMMSG2; ODBALMMSG2 = packed record alm_no: LongInt; atype: SmallInt; axis: SmallInt; dummy: SmallInt; msg_len: SmallInt; alm_msg: array [0 .. 63] of AnsiChar; end; And this is the function I use to populate this structure and read it: procedure TRdAlmMsgActionA.InternalRdAlmMsg; var iAlarm: Integer; LErrorCounter: Integer; rn: SmallInt; popmsg: PODBALMMSG2; begin FPath := ''; LErrorCounter := 0; // A random number the DLL need to have any initial value rn := 50; try // A pre-filled number with "max paths" (FConnection.MachinePaths) to read from DLL for var J := 1 to FConnection.MachinePaths do begin // A DLL function to loop between "Paths" until "FConnection.MachinePaths" FConnection.ErrHandle := cnc_setpath(FConnection.ConnHandle, J); if FConnection.ErrHandle <> EW_OK then begin Inc(LErrorCounter); Continue; end; // Here I need help: is this algorithm ok? new(popmsg); try // The DLL fill "popmsg" with an array of "PODBALMMSG2" with length "rn" FConnection.ErrHandle := cnc_rdalmmsg2(FConnection.ConnHandle, -1, rn, popmsg); if FConnection.ErrHandle <> EW_OK then begin Inc(LErrorCounter); Continue; end; // Loop for "popmsg" of length "rn" for var I := 0 to rn - 1 do begin // Here I do reading stuff with "popmsg^.alm_no", "popmsg^.aType", etc. // Incremet pointer to read next array value Inc(popmsg); end; finally // Bring the pointer at the start of the array Dec(popmsg, rn); // Free the pointer Dispose(popmsg); end; end; finally cnc_setpath(FConnection.ConnHandle, 0); end; end; I have so many doubts about this: - Have the popmsg pointer to be brought at the start before dispose? - Is the loop right? - Is the "new()" function right to allocate the pointer? - And so on... Any help? Thanks in advance. Eddy
×