Re: [NTLK] Drawbacks of C / C++ vs. Newtonscript?

From: Paul Guyot (pguyot_at_kallisys.net)
Date: Sat Oct 05 2002 - 18:47:29 EDT


À (At) 2:10 -0500 28/09/02, James Witte écrivait (wrote) :
>You can't have persistent data objects between invocations
>of the C++ routines,

You can with the Name Server. I have written a tech note about that.
Otherwise, pass a binary to the C++ methods just like Waba does.

>and (it says) you can't have virtual functions, and a
>few other things. Paul G. figured out how to make virtual functions work
>(I think), but he was writing P-Class code, and not specifically NTCK
>module code, so that *might* not apply (I really have no idea)

Virtual functions definitely work with NTK native module code. It
does work with protocol code. It doesn't work with protocol code that
is copied at another address because the system doesn't reallocate
the virtual function tables. I've written an assembly hack to work on
that.

> You can of course store persistent data on the NS heap, but then you
>have penalties everytime you access it, and if there's too much of it
>(like the VBOs in the Mad Max MP3 player) it tends to drive the VM paging
>system wild ("Oh -10061, don't we love thee..") You can store small
>amounts of data (two strings and two longints?) using the name server as
>detailed by Paul G. in one of his Bowels articles. Theoretically, you
>could allocate large chunks of memory either in the system memory domain
>or could allocate another domain, but I don't know if anyone knows how to
>do that.

You can easily allocate memory in other domains indeed. But you
normally only need the default domain. I've been able to allocate
more than 3 MB on my MP2100. If you think you need to allocate memory
in another domain (for example a domain of your own), contact me,
I'll dig in my code.

> And of course, (normal) C++ routines interrupt the execution of
>Newtonscript programs. I saw normal because they could theoretically be
>forked into preemmptively-handled tasks running in parallel with the
>inker, NS interpreter, etc.

Indeed. But they don't by default.

>The Waba interpreter *may* do this, I'm not
>sure.

No it doesn't. The only third party piece of code that does that
(except ATA Support) is NPDS Watcher. It's open source if you're
interested.

Please note that being in another thread means that you cannot access
NewtonScript objects. It's not very exciting but can be very useful
to avoid blocking the Newton's GUI. And it's much lighter than using
NewtonScript forks.

Paul

-- 
NPDS: http://newton.kallisys.net:8080/
Apache: http://www.kallisys.com/

-- Read the List FAQ/Etiquette: http://www.newtontalk.net/faq.html Read the Newton FAQ: http://www.chuma.org/newton/faq/ This is the NewtonTalk mailing list - http://www.newtontalk.net/



This archive was generated by hypermail 2.1.2 : Thu Oct 31 2002 - 12:02:09 EST