Re: [NTLK] C++ coding for the Newt

From: Paul Guyot (pguyot_at_kallisys.net)
Date: Fri Sep 20 2002 - 04:16:24 PDT


Salut Jean-Louis,

À (At) 12:52 +0200 20/09/02, Jean-louis.VILLECROZE_at_fr.thalesgroup.com
écrivait (wrote) :
>I have a few questions on writting application in C++ (I have read the
>Development FAQ) :

Daniel, these are frequently asked questions. Maybe it should go into the FAQ.

>1. Can I write a complete app in C++ (including the GUI) or do I need
>to write some part in NewtonScript ?

Short answer: No, you need some NewtonScript.
Longer answer:
The icons in the extras drawer are NewtonScript entries in the
Package soup which is made of NewtonScript entries like any other
program. So you need at least that of NewtonScript.
This is the minimum NewtonScript part. You can then have only native
code (for example with the TapScript function) that would call
NewtonScript functions when required.
Please note that NewtonOS GUI widgets are NewtonScript frames as
well. They are composed of basic elements that are handled by native
code (nobody created their own basic element yet, although it seems
possible).

>2. My developement environment is GCC (x86), can I easy target the
>Newton architecture ? (I'm running QNX on the host computer)

Short answer: No.
Longer answer:
* You need to pack your code into a Newton package or Newton Native
Module for NTK. The format is described in available documentation,
but the only tools that do that run on MPW and uses ARM Image Format
input. gcc doesn't generate AIF.
* Once you've told gcc to generate big endian code, you'll still have
the problem that it doesn't mangle names the same way. This will
prevent you to link with Apple's libraries. So you'll need to
disassemble them or to convert them (don't worry, 95% of the
libraries are just calls to routines at a fixed address, in the jump
table).

>3. What are my chance of getting an application working without using
>the NCT ?

Short answer: low.
Long answer: see the previous answers.
Note that if you want to use NTK, it will mean less work than
bypassing NTK as well.
You'll need to make some tool that take an ELF object code and
converts it (with a .exp) into a native module for NTK. Then you
could use WinNTK or NTK.

>4. How can I create a package holding my newly created application ?

a/ use NTK
b/ write something like NTK.

Everything is publicly documented. See:
Newton Formats (draft, confidential ;)
Newton Toolkit File Formats

They're on UNNA, David Arnold's website and links are in the FAQ.

Paul

PS: you can't have global variables in NewtonOS native code
PPS: ARM compilers are much superior to gcc for ARM code
PPPS: Have you ever tried to compile gcc for cross-compilation? ;)
PPPPS: tu connais Newton-FR?

-- 
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.5 : Mon May 26 2003 - 12:59:22 PDT