Wilbert
Thank you, again, for your help.
I have now created a new procedure that I can call from my main program to clear the memory allocation from the *m = UTF8(s) statements. I have made *m a global variable.
Everything seems to work but, in my testing, I have found that if I call the routines about three times it crashes my main app. I don't get any indication of where that is happening.
This is not a DLL per se, it is a dylib as I run on a Mac (and in 64-bit mode). I have the following procedures in the dylib:
Code: Select all
; Clear the *ret memory allocation
ProcedureCDLL ClearMemory()
; Send an Integer from Program
ProcedureCDLL PutInteger(i.i)
; Send an Integer to Program
ProcedureCDLL.i GetInteger()
; Send a Double from Program
ProcedureCDLL PutDouble(d.d)
; Send a Double to Program
ProcedureCDLL.d GetDouble()
; Send a String from Program
ProcedureCDLL PutString(s.s)
; Send a String to Program
ProcedureCDLL.i GetString()
; Send all three
ProcedureCDLL PutAll(i.i, d.d, s.s)
; Get all three
ProcedureCDLL.i GetAll()
You can see that this is just a test dylib so I can test both input and output from my calling app. First time through all runs well. Same with second time but after three or so iterations my main app just crashes and I cannot see where.
Do you think it is a memory problem, the way in which I have constructed the dylib or what?
I am at a total loss at the moment. I really need PB as a backend dylib compiler and it seems just perfect for my needs but I cannot have a dylib that works once then crashes the app!
Simon.