Unexpected build error. (Again.)

DaveB
2011-11-21
2013-04-30
  • DaveB
    DaveB
    2011-11-21

    Hi…

    ComPort Library ver. 4.0,
    Delphi 7,
    Win XP SP3 all up-to-date.

    I need to get back into a recent project, successfully built and deployed earlier this year with TComPort as an integral part. But I'm once again getting these build errors when rebuilding the project after some minor UI changes unrelated to the Comport component when rebuilding the project. 

    CPort.pas(750): Incompatible types: 'Array' and 'TWOHandleArray'
    CPort.pas(2043): Incompatible types: 'Array' and 'TWOHandleArray'

    This was an issue once before, but it sort of (somehow) fixed itself, but obviously the problem is back.

    Now, I've no gripe with TComPort, it works brilliantly (when built!) but due to the elapsed time since I was last in Delphi, it's a showstopper for me again.

    So, what do I need to do, to fix or mitigate this problem once and for all?

    TIA.

    Dave.

     
  • DaveB
    DaveB
    2011-11-23

    Well…

    After some poking about.

    In Cport.pas, "procedure TComThread.Execute" at about line 740 there is a declaration:-
    EventHandles: array of THandle;   It is this what is causing D7 to throw the error.

    After tracking down what TWOHandleArray is, and where defined, and as a result of looking in Delphi's Windows.pas file, I redefined the above as:-
    EventHandles: TWOHandleArray;

    Also, in procedure "TCustomComPort.WaitForEvent(……..
    at or about line 2020, there is an identical declaration, also edited like the above.

    My project now compiles fine, and still works too!    I have no idea whatosever, why it once worked as original, then didn't.

    The only downside, is that EventHandles is now a 64 element, not a two element array.  But it matches what's been earlier defined in Windows.pas.

    Comments anyone?

    Regards.

    Dave (happy for once!)

     
  • Why would you use Comport 4.0 library instead of the latest 4.11 ?

     
  • DaveB
    DaveB
    2011-11-24

    Well, because it's what I've got.

    Now…  In CPort.pas, this is shown as the file header…

    (******************************************************
    * ComPort Library ver. 4.0                           *
    *   for Delphi 3, 4, 5, 6, 7, 2007-2010,XE  and      *
    *   C++ Builder 3, 4, 5, 6                           *
    * written by Dejan Crnila, 1998 - 2002               *
    * maintained by Lars B. Dybdahl, 2003                *
    * Homepage: http://comport.sf.net/                   *
    *                                                    *
    * Brian Gochnauer Oct 2010                           *
    *     Removed ansi references for backward compat    *
    *     Made unicode ready                             *
    *****************************************************)

    But the folder it lives in, is labled "Comport4.11" dated Feb 2011    However, if I add a port component to a new Delphi form, then right click on it, at the top of that popup, it says it's V3.0   Where as, the version history file that it came with, stops at V3.1  Also a Readme file that it came with, is dated 2010, and says it's version 4.10.

    The zipfile all that came in, is named indicating it's V4.11!   Dated Feb 2011.

    So go figure?   How in detail does one tell *Exactly* what version one has.

    In any case, I've often had significant problems after updating a third party component, needing dozens of other things I've built with it recompiling, in some cases drasticaly altering to accomodate changes in the component etc, so unless there is some compelling mega visable to the unwashed web open vulnerability, or fundamental unreliability that is forever causing crashes, why update?

    Some of the utilities I've built with it (remote control tools for my ham shack) run 24/7, some being up and active for months at a time, so no apparrent issues there either.

    As I'm doing this for a hobby as much as anything else, I prefer stuff that "just works".   Also, I'm just using the basic serial port functionality, not the terminal emulators, or packet driver etc.   And I have to say, it all works splendidly, on W2000, XP, & Vista.  I have also tried one of my programs on Win7 (starter, 32 bit), with no issues either, once the needed specific USB adapter drivers were installed.

    I've just had a poke arround this SF site, and can't see any file that lists changes over it's history, so I do not have any idea of exactly what version I have, just that it works, and now I can build with it, withouth any pi$$y compiler errors.

    Does any of that answer anything?

    Regards.

    Dave B.

     
  • I understand the comment  "I prefer stuff that "just works". me too.
    Which is why many of the files don't have updated version identifications
    because it does nothing towards making it work better.

     
  • Your original question; as to the error

    CPort.pas(750): Incompatible types: 'Array' and 'TWOHandleArray'
    CPort.pas(2043): Incompatible types: 'Array' and 'TWOHandleArray'

    is a compiler directive issue not a code issue
    adding
    {$T-} //typed @ operator off
    to the top of CPort.pas file