On Sat, 26 Feb 2011, Jonas Maebe wrote:
On 26 Feb 2011, at 11:15, Michael Van Canneyt wrote:
On Fri, 25 Feb 2011, leledumbo wrote:
can i pass ansistrings ?
Yes, but only if you know what you're doing. NEVER modify the passed strings
(it would confuse the reference counting). Use const parameter all the time.
It will almost certainly lead to memory leaks, because a simple
a:=b;
inside the library with b passed on from the main program, will lead to
problems as soon as the library is unloaded.
It shouldn't matter with cmem/sharemem, because
a) unloading a library from within one of its own routines is not possible,
so there cannot be any local variables in the shared libraries holding a
reference at such a point
b) global variables are finalised when the library is unloaded
This is correct. I didn't know about sharemem, though.
I should document it :-)
Michael.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal