Announcement
Collapse
No announcement yet.
Garbage collection for PB?
Collapse
X
-
Maybe you could/should ask in an MS-Excel user or developer group? Those folks would have to know about doing this kind of stuff specifically with MS-Excel.
MCM
Leave a comment:
-
I know but there are exceptions, like Excel/xll
Unless i am very wrong here.
Leave a comment:
-
Because the callee(your object) is returning a string, what is wrong with conforming to the
rules of COM by having your object allocate the string using SysAllocString. The caller is
responsible for freeing a string returned via an out parameter using SysFreeString.
Leave a comment:
-
Of course this example is wrong but i would like to destroy after the caller has obtained the data (Excel).
You could use a timer enuming com interfaces and check a status flag for example.
Looking for something clever with a similar approach.
Leave a comment:
-
>Local oInterface1 As Interface1
Per doc (hard to fnd), any LOCAL "as <interface>" variables are automatically cleaned up when exiting the function. (ie LET varname=NOTHING is done for you).
What is it you want to explicitly destroy or not destroy? The string (property value)?
Leave a comment:
-
Garbage collection for PB?
For my xll (Excel addin) i would like to invent a new way to claim memory and destroy it right after the call.
When Excel calls my function, i can not destroy the returned string.
Using a STATIC is an option but not threadsafe.
Using arrays holding memory pointers is an option, i am looking for something different so i tried this (not working):
Code:[color=#0000FF]Class[/color] Class1 [color=#0000FF]Class[/color] [color=#0000FF]Method[/color] [color=#0000FF]Destroy[/color] [color=#0000FF]MsgBox[/color] "END" [color=#0000FF]End[/color] [color=#0000FF]Method[/color] [color=#0000FF]Interface[/color] Interface1: [color=#0000FF]Inherit[/color] [color=#0000FF]IUnknown[/color] [color=#0000FF]Property[/color] [color=#0000FF]Get[/color] Value() [color=#0000FF]As[/color] [color=#0000FF]String[/color] [color=#0000FF]Property[/color] = "1234" [color=#0000FF]End[/color] [color=#0000FF]Property[/color] [color=#0000FF]End[/color] [color=#0000FF]Interface[/color] [color=#0000FF]End[/color] [color=#0000FF]Class[/color] [color=#0000FF]Function[/color] Test() [color=#0000FF]As[/color] [color=#0000FF]String[/color] [color=#0000FF]Local[/color] oInterface1 [color=#0000FF]As[/color] Interface1 oInterface1 = [color=#0000FF]Class[/color] "Class1" [color=#0000FF]Function[/color] = oInterface1.Value() [color=#0000FF]End[/color] [color=#0000FF]Function[/color] [color=#007F00]' Execute[/color] [color=#0000FF]MsgBox[/color] Test()
Maybe you have an idea similar to this and handy to use?
Tags: None
Leave a comment: