[comp.lang.c] Child processes redefined

ojpotter@fred.cs.washington.edu (07/06/90)

Thank you to everyone that responded to my earlier problem.  Unfortunately
I must  have phrased my question incorrectly.  Many of suggested that system()
would do exactly what I wanted.  I had already looked at system() before posting
this problem and it wasn't quite what I need.  I want to use these external
executables as runtime functions.  I want to pass them parameters and get a
calculated return value back.  I want my program to be able to configure the
functions it uses according to a configuration file.

Example:

One line of the configuration file might read:

SIGNAL_GENERATOR=HP3325A

And out of that I want my program to build an execute path string that will
call the specified executable and get the value returned from the executable
not the status of the shell.

I'm sorry about the confusion (like this is less confusing).  I hope to hear
from more of you about a solution, I'm still stumped. Thanks again.

Jay Potter
ojpotter@fred.cs.washington.edu

pajerek@usenet@kadsma (Don Pajerek) (07/06/90)

In article <12473@june.cs.washington.edu> ojpotter@fred.cs.washington.edu () writes:
> I want to use these external
>executables as runtime functions.  I want to pass them parameters and get a
>calculated return value back.
>
>Jay Potter


Am I missing something, or won't fork/exec do the job?


Don Pajerek

archer@elysium.sgi.com (Archer Sully) (07/11/90)

In article <1990Jul6.145122.14785@usenet@kadsma> pajerek@usenet@kadsma (Don Pajerek) writes:

>In article <12473@june.cs.washington.edu> ojpotter@fred.cs.washington.edu () writes:
>> I want to use these external
>>executables as runtime functions.  I want to pass them parameters and get a
>>calculated return value back.
>>

>Am I missing something, or won't fork/exec do the job?

It may.  Then again, it may not.  If the dynamic function needs to access
data and text from the main program, then using a fork/exec scheme will
be either insufficient or inefficient, because the data would have to 
be passed through some arcane means (encoding in strings for parameters,
shared memory, etc...).   Return values suffer similar problems.  If all
that is needed is an int return, then it shouldn't be too tough, but if
floating point or a structure of some sort is required, it gets more 
difficult.

The C language does not define dynamic loading.  That is a feature of the
operating system, and many do not have it.  

Archer Sully 	      |  Ask not what you can do for you country,
(archer@esd.sgi.com)  |  But what your country's been doing to you.
                      |                    -- The Avengers