Puzzled #PB_Compiler_Debugger in pb-user-lib

Just starting out? Need help? Post your questions and find answers here.
User avatar
Zebuddi123
Enthusiast
Enthusiast
Posts: 794
Joined: Wed Feb 01, 2012 3:30 pm
Location: Nottinghamshire UK
Contact:

Puzzled #PB_Compiler_Debugger in pb-user-lib

Post by Zebuddi123 »

Hi to all :D in the following code I have a CompilerIf for the debugger which works as intended as an Include file but when Compiled as a User lib with MiniLib. ( :D Thanks @docroger)
Seems to me that because the code is pre-compiled as a lib, the debugger constants are ignored ?
All help appreciated.
Zebuddi. :)

Code:

Code: Select all

;#IDEWindowID = 4654100
ProcedureDLL _WriteIDELog(sMessage.s); Write a message to IDE Log
	Protected CopyData.COPYDATASTRUCT
	Protected IDEWindow = Val(GetEnvironmentVariable("PB_Tool_MainWindow"))
	
	CompilerIf #PB_Compiler_Debugger
		CompilerIf #PB_Compiler_IsMainFile
			MessageRequester("in debugger mode", "grrrr..") ; for debugging cause wont work 
		CompilerEndIf
		; when compiled a pb user lib
		CompilerIf Not Defined(IDEWindowID, #PB_Constant)
			MessageRequester(#PB_Compiler_Procedure + 
			                 "() ... IDEWindow ID not Defined", 
			                 "Add  The Constant " +
			                 "'#IDEWindowID = '" + 
			                 " With the 'IDEWindow Value' to Your Source Code - Dohhhh..",
			                 #PB_MessageRequester_Error)
			End
		CompilerElse
			IDEWindow = #IDEWindowID
		CompilerEndIf
	CompilerEndIf
	
	If (IDEWindow And sMessage)
		CopyData\dwData = ('L' << 16) | ('O' << 8) | 'G'
		CopyData\cbData = StringByteLength(sMessage, #PB_Ascii)
		CopyData\lpData = AllocateMemory(CopyData\cbData + 1)
		If CopyData\lpData 
			PokeS(CopyData\lpData, sMessage, -1, #PB_Ascii)
			SendMessage_(IDEWindow, #WM_COPYDATA, #Null, @CopyData)
			FreeMemory(CopyData\lpData)
		EndIf    
	EndIf
EndProcedure

_WriteIDELog("Holy molly ... grrr")
malleo, caput, bang. Ego, comprehendunt in tempore