delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/15/10:34:19

Message-Id: <200009151433.JAA00227@darwin.sfbr.org>
Date: Fri, 15 Sep 2000 09:34:48 -0500 (CDT)
From: Jeff Williams <jeffw AT darwin DOT sfbr DOT org>
Subject: Re: pass C source to program binary?
To: djgpp AT delorie DOT com
MIME-Version: 1.0
X-Mailer: dtmail 1.3.0 @(#)CDE Version 1.3.4 SunOS 5.7 sun4u sparc
Reply-To: djgpp AT delorie DOT com

> >Is there a obvious technique for passing the source code for a small C
> >function (e.g., `for (i=1;i<=N;i++) y[i]=foo(x[i]);'), which might be in
> >a file or passed via command-line, to an already-compiled C program and
> >have that program be able to interpret and use the function internally?

-: Write an interpreter for a C-Like Language.

Is this the way gnuplot (for example) `reads' functions for plotting?
I suppose I could toss everything into a Tcl environment, but that
would be massive overkill for this application.

-: sounds like a lex and yacc job to me. (or flex and bison,
-: if you are gnu to this... ugh)

Yes, that's the direction I initially took, but it gave me nightmares.

-: Use DXEs:
-: 1. Call to gcc.exe to compile the external C file.
-: 2. Call dxegen.exe to make it into a DXE.
-: 3. Load it with _dxe_load().
-: 4. Run it.

Ok, I like this idea.  It sounds straightforward and involves minimal
overhead.  I'll take a stab at it.

Thanks to everyone who replied.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019