[NTLK] Globals in C++

From: Jim Witte (jswitte_at_bloomington.in.us)
Date: Mon Sep 13 2004 - 09:37:27 PDT


> global variables, something that isn't allowed in NewtonOS
> native code runtime architecture. So to port SSH/SSL, you not only
> have to
> compile a library providing these features (such as openssl/openssh or
> lsh), but you also have to fix the libraries by removing all the global
> variables.

   AFAIK, globals aren't allowed in NCT parts because there's just a set
of functions - there's no persistenent memory space set up
automatically. But, you can register things with the name server, or
create your own memory domain (or just allocate a block off the heap).
p-classes can have instance variables - the MPCodec uses them to store
info about the stream and frame and audio_stats (used by the dithering
routines). Tasks ((or anything else) can also have allocated directly
on the heap (see Paul's NSWatcher example from the NPDS source for how
to do this from a task). TUTask might also be able to be subclassed so
you could have instance variables, but I'm not sure.

  Domains are in the available headers, but I don't think there's any
code out there on how to use them (allocate, deallocate). And you can
also stick things in NS frames and put a reference to the frame into
the name server. You can also allocate new NS references from C++ - I
don't know if there's sample code though.

   Question to potential developers: *Are* these methods something
people would like to see samples of how to do?

Jim

-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
Official Newton FAQ: http://www.chuma.org/newton/faq/
WikiWikiNewt for all kinds of articles: http://tools.unna.org/wikiwikinewt/


This archive was generated by hypermail 2.1.5 : Mon Sep 13 2004 - 10:00:02 PDT