Benoît Minisini ha scritto: >>> VarPtr() must be used when a C-function argument is actually a pointer to >>> a variable that will be modified by the called function. >>> >> I disagree for two or three reasons. First, an external declaration >> already implies that the declaration refers to something extraneous to >> gambas, where things are different. This is even more true for gambas, >> which only needs EXTERN to interface to modules written in other >> languages, because it has a more natural and efficient way to use its >> own modules/components. >> The second reason is that using BYREF in the external declaration, the >> task of the function is well defined for now and forever. Actually, in >> that case, BYREF would internally mean something different - but anyway >> all the declaration takes a totally different way in its implementation. >> But, at high, logic level, BYREF would keep its intimate meaning. >> Third, if I can not declare an external parameter with BYREF, I must >> then use varptr() on every call - this moves the logic from declaration >> to its usage - and there is more to type on the keyboard. >> > This is not possible, because Gambas use dynamic linking. You have to specify > VarPtr() at function call. > > Moreover, even if I agree that the ByRef syntax is nicer, it cannot be used > there again because of the dynamic linking: ByRef for a Gambas function > implies compiling a different code than your ByRef for an extern function, and > as Gambas may not know at compile time if a function is extern or "intern", he > cannot do that. > I understand.
> > I admit that the design may not be perfect, but again all these syntax cover > all the needed features for memory access. This is not just a matter of using > one keyword instead of another one. And structures are implemented correctly, > except that you cannot pack them. > > And beware: memory allocated by Alloc() must be freed with Free(), and you > must not use Free() to free memory allocated by an extern function! Alloc() > does not call the glibc malloc() directly, and Free() does not call the glibc > free() directly too. > I see your point - I will use what's already inside the box. This leads to my last question: how can I download a local copy of the wiki? I tried two or three times with wget, but the result is unuseable. Regards, Doriano ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://ad.doubleclick.net/clk;226879339;13503038;l? http://clk.atdmt.com/CRS/go/247765532/direct/01/ _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user