[comp.sys.next] NeXT programming question

paul@phoenix.Princeton.EDU (Paul Lansky) (12/22/90)

I wonder if anyone has a solution or a better way to
do the following:
I have an application which parses a text file, converts it
to C code and then compiles and executes it with a system
call within the application.  The application then reads the
data created and draws the appropriate plots.  It works
but I think it is a kludge.  I don't see anyway around
calling the C compiler short of writing my own interpreter but I hate 
to use system("cc etc").  I just feels wrong.  Any cute ideas?
The application is built in NeXTStep with the interface builder.
Thanks 

Paul Lansky
paul@princeton.edu

Music Dept.
Princeton University

wjs@milton.u.washington.edu (William Jon Shipley) (12/22/90)

Paul Lansky writes:
>I have an application which parses a text file, converts it
>to C code and then compiles and executes it with a system
>call within the application.  The application then reads the
>data created and draws the appropriate plots.  It works
>but I think it is a kludge.  I don't see anyway around
>calling the C compiler short of writing my own interpreter but I hate 
>to use system("cc etc").  I just feels wrong.  Any cute ideas?

At Stanford Linear Accelerator this summer we had a similar problem.  I solved
it much the way you did, except I dynamically linked the new c code into my
running code, looked up the address of its entry point (now in my address
space), and just simply called it.

This was actually pretty speedy (5 seconds on an 030), and, of course, the code
flew.

You can find out about dynamic linking either by doing a "man rld" on 2.0, or
writing me. (My dynamic linking package has some features NeXT's is missing,
and vice versa.)

-w