Invalid memory access for library compiled at command line

TailBite specific forum

Moderators: gnozal, ABBKlaus, lexvictory

Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Invalid memory access for library compiled at command line

Post by Mistrel »

I have a TailBite library that is causing an invalid memory access in Windows Vista only when compiled from the command line and does not occur when compiling from the IDE. The error occurs only in Windows Vista. The error still occurs whether I compile the library under XP or Vista.

I'll send you the log file and the generated asm in a PM.

The filesize of the libraries produced from the IDE and the command line are not identical.

Maybe this can glean some insight on the CHM problem as well.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

Scratch that. This is a completely bizarre bug.

It will stop occurring if I rename the library or comment out the function name that is causing the error (even after removing all of the function contents).

I cannot reproduce it in another TailBite library..
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Post by Mistrel »

I think I've narrowed it down to one function but I cannot reproduce it in a simple TailBite file outside of my project.

This code compiles fine:

Code: Select all

Procedure LoadDBErrorCodes()
	Global Dim DBRuntimeError.s(10000)
EndProcedure
and TailBite produces the following ASM:

Code: Select all

; Procedure LoadDBErrorCodes()
macro MP10{
_Procedure10:
  PS10=4                                                                                                                                                                                                                                                   
; Global Dim DBRuntimeError.s(10000)
  PUSH   dword 8
  PUSH   dword a_DBRuntimeError
  PUSH   dword s_s
  MOV    edx,dword [a_DBRuntimeError]
  CALL   SYS_FreeStringStructuredArray
  MOV    eax,10001
  PUSH   dword 4
  CALL   SYS_AllocateArray
; EndProcedure
  XOR    eax,eax
_EndProcedure11:
  RET
}
The following code causes the access violation:

Code: Select all

Procedure LoadDBErrorCodes()
	Global Dim DBRuntimeError.s(10000)
	DBRuntimeError(0000)="An unknown error has occurred"
EndProcedure
TailBite produces the following ASM:

Code: Select all

; Procedure LoadDBErrorCodes()
macro MP10{
_Procedure10:
  PUSH   ebp
  PUSH   ebx
  PS10=12                                                                                                                                                                                                                             
; Global Dim DBRuntimeError.s(10000)
  PUSH   dword 8
  PUSH   dword a_DBRuntimeError
  PUSH   dword s_s
  MOV    edx,dword [a_DBRuntimeError]
  CALL   SYS_FreeStringStructuredArray
  MOV    eax,10001
  PUSH   dword 4
  CALL   SYS_AllocateArray
; DBRuntimeError(0000)="An unknown error has occurred"
  MOV    ebp,dword [a_DBRuntimeError]
  MOV    edx,_S1
  LEA    ecx,[ebp]
  CALL   SYS_FastAllocateStringFree
; EndProcedure
  XOR    eax,eax
_EndProcedure11:
  POP    ebx
  POP    ebp
  RET
}
I hope this is something to go on.
Post Reply