'This is just a test and a learning tool to show how BCX handles Dynamic strings, creating and freeing. 'It also shows a bug where a dynamic string inside the events loop doesn't get freed until the next sub/function. 'Look at the c code and compiler errors emitted to understand the limitations of using BCX strings '$' against 'AS CHAR' and FREE 'Ian GUI "Form1",PIXELS '$SOURCE CONST Btn1_Style = WS_CHILD|WS_VISIBLE|WS_TABSTOP CONST Btn1_ExtStyle = WS_EX_STATICEDGE ENUM ID_Btn1 END ENUM GLOBAL Form1 AS HWND GLOBAL hBtn1 AS CONTROL SUB FORMLOAD() Form1 = BCX_FORM("Form1", 0, 0, 287, 162) hBtn1 = BCX_BUTTON("Button",Form1,ID_Btn1, 64, 56, 56, 24, Btn1_Style, Btn1_ExtStyle) CENTER(Form1) SHOW(Form1) END SUB BEGIN EVENTS Dim r$ * 1234 Global s$ * 5678 Dim t$ SELECT CASE CBMSG CASE WM_COMMAND SELECT CASE CBCTL CASE ID_Btn1 Dim myString$ * 12800 Dim myOtherStr$ myString$ = "hello" Call FOO 'BCX should free myString$ here but doesn't END SELECT END SELECT 'BCX should free r$ here but doesn't END EVENTS Sub DoSomething() 'the FREE myString$ & r$ fall through to here? End Sub 'originally taken from the BCX help file, I expanded it to check 'how different types of string dimensioning work. SUB FOO DIM a$ * 1000 ' a$ is LOCAL with automatic Free LOCAL b$ * 1000 ' b$ is LOCAL with automatic Free GLOBAL c$ * 1000, d$ * 1000 ' c$ and d$ are global DIM e$ Static f$ * 1000 LOCAL g$ LOCAL h$ * 1000 If hBtn1 Then Dim i$ * 12345 Dim j$[34567] as char Dim k[12345] as char Call DoSomething 'BCX should free i$ here but doesn't FREE j$ FREE k$ End If 'handled properly I think? FREE c$ 'Not needed in BC 5.12 ' GLOBAL MUST be freed before exit FREE d$ 'Not needed in BC 5.12 ' GLOBAL MUST be freed before exit END SUB Sub DoSomethingElse() End Sub