Menu

Bytecode cannot BSAVE or BLOAD twice (Windows only)

Wanderer
2015-04-01
2015-12-02
  • Wanderer

    Wanderer - 2015-04-01

    I found (in the Windows version only) that a bytecode file seems to produce a Segmentation Fault when it reaches a second BSAVE or BLOAD statement. I tested the following program:

    If android?
      baseDir$="/mnt/sdcard/bas/"
    Else
      baseDir$=""
    EndIf
    
    s1$ = "A test string."
    s2$ = "Another test string."
    BSave baseDir$+"testfile1.txt", VarPtr(s1$), Len(s1$)
    Print "File 1 saved."
    BSave baseDir$+"testfile2.txt", VarPtr(s2$), Len(s2$)
    Print "File 2 saved."
    
    LoadStrings:
    t1$ = Space$(size(baseDir$+"testfile1.txt"))
    Print "Allocated t1 = "; Len(t1$); " bytes."
    BLoad baseDir$+"testfile1.txt", VarPtr(t1$)
    Print "Loaded t1 = "; t1$
    t2$ = Space$(size(baseDir$+"testfile2.txt"))
    Print "Allocated t2 = "; Len(t2$); " bytes."
    BLoad baseDir$+"testfile2.txt", VarPtr(t2$)
    Print "Loaded t2 = "; t2$
    Input x$
    End
    

    When run from the interpreter, output was as expected:

    File 1 saved.
    File 2 saved.
    Allocated t1 = 14 bytes.
    Loaded t1 = A test string.
    Allocated t2 = 20 bytes.
    Loaded t2 = Another test string.
    

    However, when running the bytecode file produced from this program, the output was the following:

    File 1 saved.
    ERROR at offset $9c: ** 1 - Segmentation fault
    PC negativ !
    ** PROGRAM-STOP
    

    I then inserted the following lines after defining baseDir$:

       If exist(baseDir$+"testfile2.txt")
         GoTo LoadStrings
       EndIf
    

    Running the bytecode file from this version of the program, I got the following output:

    Allocated t1 = 14 bytes.
    Loaded t1 = A test string.
    Allocated t2 = 20 bytes.
    Error at offset $192: ** 1 - Segmentation fault
    PC negativ !
    ** PROGRAM-STOP
    
     
  • Markus Hoffmann

    Markus Hoffmann - 2015-04-14

    It doesnt occur in the new release 1.23-20. Do you still see it?

     

    Last edit: Markus Hoffmann 2015-04-16
  • Wanderer

    Wanderer - 2015-12-02

    Hello Markus,

    sorry for letting you wait so long for an answer ... yes, it is fixed, thank you very much.
    I was on some long wanderings and don't know yet when I will have time again for a next X11-Basic project ... will see.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.