Error on compile with Optimising

Discussion in 'Questions (Windows Mobile)' started by TonyGprs, Jan 25, 2008.

  1. TonyGprs

    TonyGprs New Member Licensed User

    Hi,

    I am using the supplied sample for HTTP

    I have a problem with the following line of code in V6.01:

    FileOpen(c1,UploadFile,cRandom)

    This builds OK and compiles OK with Optimisation off.
    With Optimising ON however, I get an error:

    Index was out of Range. Must be non-negative an less than the size of the collection.
    Parameter name:Index

    This line of code is from the HTTP Sample and compiles - runs fine in V5.x

    Any thoughts greatly appreciated.

    Best Wishes

    Tony Hunt
     
  2. specci48

    specci48 Well-Known Member Licensed User

  3. TonyGprs

    TonyGprs New Member Licensed User

    Thank you specci48,

    Unfortunately I had already spotted using V5.x.

    The problem is still there.
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Can you post your code?
     
  5. TonyGprs

    TonyGprs New Member Licensed User

    Hi,
    Thanks for the quick response.

    While collecting the code to post, I have found the problem.

    The original code in the sample is.

    Sub UploadFile (UploadFile, URL) 'Requires a server with write permission.

    NOTE.. The Sub name is the SAME as the first parameter IE:UploadFile

    So when the code
    FileOpen(c1,UploadFile,cRandom)
    is compiled USING THE OPTIMISER IN V6.01, it looks as though it's passing the sub UploadFile as a parameter to the function FileOpen()


    Change this to..
    Sub UploadFile (LocalFile, URL) 'Requires a server with write permission.

    then..
    FileOpen(c1,LocalFile,cRandom)


    This Now Optimises and runs fine.. It's obviously the result of the less forgiving new compiler..

    That can only be a good thing.

    Best wishes for your excellent product..

    Tony Hunt
    http://www.gprsdatasystems.com
     
    Last edited: Jan 27, 2008
Loading...