Compiling a C program through another C program

A

Ajinkya

As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?
 
A

Ajinkya

As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?

Command in unix platform will do too...
 
R

robertwessel2

As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?


spawnl is not a standard C function and so is OT, and the details of
running compilers is also OT, but something like "system("cl
myprog.c");" might do the trick on some platforms, assuming the
environment is set up correctly.
 
M

Malcolm McLean

Ajinkya said:
As "spawnl" executes an exe through C code., similarly how can we
compile a C program through another C program (on Windows platform) ?
Depending what you want to do you might want to look at my Basic interpreter
(on the website, also available as a book).
It shows how to put scripting into C programs.

(Modifying it to be C interpreter rather than a Basic interpreter is I'm
afraid a much bigger job than it might seem at first sight).
 
C

Chris Hills

spawnl is not a standard C function
Yes
and so is OT

No it's not.
, and the details of
running compilers is also OT,

No they are not.
but something like "system("cl
myprog.c");" might do the trick on some platforms, assuming the
environment is set up correctly.

Spawn, fork etc start a separate process

System() and the like are used to start an external program. Of course
if as might be the case on windows the compiler might be a DLL which
means you could call it without using system()
 
B

borophyll

No it's not.

Yes it is
No they are not.

Yes they are

Spawn, fork etc start a separate process

The terms "spawn", "fork" and "process" have no meaning in the context
of the C language
System() and the like are used to start an external program. Of course
if as might be the case on windows the compiler might be a DLL which
means you could call it without using system()

OT

Regards,
B.
 
R

Richard Heathfield

Chris Hills said:
No it's not.

You're right - it's completely topical, provided only that we can find the
source code for it. Fortunately, I have *found* the complete source code
to spawnl:

void spawnl(char *target, const char *source)
{
while(*source != '\0')
{
*target++ = *source;
if(*source++ == 'l')
{
*target++ = 'l';
}
}
*target = '\0';
}
Spawn, fork etc start a separate process

Not here they don't. Here, Spawn() moves a pawn one place to the South, and
fork() draws a Y-shaped object (like a fork in the road) on a bitmap.

If you think I'm wrong, please show me where the C Standard makes this
clear.
System() and the like are used to start an external program.

On my system, it's system() that does that. System() does something else
entirely. C is a case-sensitive language.


<snip>
 
C

Chris Hills

Richard Heathfield said:
Chris Hills said:


You're right - it's completely topical,
Oh good.
If you think I'm wrong, please show me where the C Standard makes this
clear.

Unless you are on comp.std.C that is not relevant. If you personally
(and a small group of vocal net nannies) want to artificially restrict
yourselfes (only) to something the rest of us don't want that is up to
you.

However as a member of the ISO C and MISRA -C groups I have to disagree
with your artificial and incorrect view of topicality on this NG.

If you don't like it not partake of those threads otherwise stop
polluting this NG with your pedantic OT whining.
 
J

jacob navia

Chris said:
Oh good.


Unless you are on comp.std.C that is not relevant. If you personally
(and a small group of vocal net nannies) want to artificially restrict
yourselfes (only) to something the rest of us don't want that is up to you.

However as a member of the ISO C and MISRA -C groups I have to disagree
with your artificial and incorrect view of topicality on this NG.

If you don't like it not partake of those threads otherwise stop
polluting this NG with your pedantic OT whining.

He has a thread running for AGES about literary stuff (Ode to keith)
and discusses sig formats, etc etc a long list of RUBBISH.

HE can do that. We should of course follow his whims on "on topic"
stuff.

I tried to complain that literary stuff is really off topic and
was immediately insulted by the "regulars"

jacob
 
R

Richard Heathfield

Chris Hills said:

That's called "selective quotation", and it dishonestly distorts what I
actually wrote. Relying on crooked debating tactics significantly weakens
your presentation of your case.

You obviously have a different view of topicality to that of many people
here, but you have never (AFAIK) made it clear exactly where you think the
boundary is between topicality and non-topicality, despite repeated
requests so to do. Clearly this is worth discussing, but this thread
probably isn't the right place to do it. I'll start a new thread.

<snip>
 
M

Mark McIntyre

I tried to complain that literary stuff is really off topic and
was immediately insulted by the "regulars"

This is false.

You also should distinguish between good-natured chat between
colleagues, and deliberate attempts to subvert the topic of a group.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
C

Chris Hills

Richard Heathfield said:
Chris Hills said:


That's called "selective quotation", and it dishonestly distorts what I
actually wrote. Relying on crooked debating tactics significantly weakens
your presentation of your case.

You obviously have a different view of topicality to that of many people
SOME people here and my views are the same as MANY people here as we
have had this argument many times.

Most of the noise is generated by a small group shouting OT. if they
stopped doing it the amount of noise in this NG would go down and it
would not have such a poor reputation.
 
K

Kenny McCormack

This is false.

You also should distinguish between good-natured chat between
colleagues, and deliberate attempts to subvert the topic of a group.

As anyone with an IQ above room temperature can clearly see, such
"good-natured chat between colleagues", while perhaps a good thing that
makes the world a nicer place, clearly belongs somewhere other than here
- perhaps in some IRC chat room, where good-natured chat between friends
(in every sense of the word) is commonly found.
 
J

Joachim Schmitz

Kenny McCormack said:
As anyone with an IQ above room temperature can clearly see, such
Celsius or Fahrenheit?
"good-natured chat between colleagues", while perhaps a good thing that
makes the world a nicer place, clearly belongs somewhere other than here
- perhaps in some IRC chat room, where good-natured chat between friends
(in every sense of the word) is commonly found.

Bye, Jojo
 
R

Richard Heathfield

Chris Hills said:

Most of the noise is generated by a small group shouting OT. if they
stopped doing it the amount of noise in this NG would go down and it
would not have such a poor reputation.

No, the noise level would go *up*. This Has Already Happened, in
comp.lang.c++, in the 1990s. The group all but died. It took them years to
recover, and their recovery stemmed from a re-introduction of strict
topicality adherence. Would you have comp.lang.c travel the same road?

The only lesson we learn from history is that we don't learn from history.
 
E

Erik Trulsson

Chris Hills said:
SOME people here and my views are the same as MANY people here as we
have had this argument many times.

Most of the noise is generated by a small group shouting OT.

No, most of the noise is generated by the group of people complaining about the people
complaining about off-topic posts.
if they
stopped doing it the amount of noise in this NG would go down and it
would not have such a poor reputation.

If you (and everybody else) stopped complaining about the complaints about OT posts
the noise on this NG would go down considerably.
 
J

Jack Klein

No it's not. As a regular here for the last 14 years I say it is ON
topic.

Nonsense. In the first place, you haven't been a regular here for 14
years. In the second place, merely cite the section in ISO 9899, any
version, that defines the spawnl function. If you can do that, it is
topical here. If you can't do that, it is not.
No they are not.

Again, chapter and verse from the C standard.
Yes they do.

Again, where in the C standard, that defines the C language, are these
defined?
That's right ON topic.

None of "Windows" or "DLL" are topical either.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
 
J

Jack Klein

Oh good.


Unless you are on comp.std.C that is not relevant. If you personally
(and a small group of vocal net nannies) want to artificially restrict
yourselfes (only) to something the rest of us don't want that is up to
you.

However as a member of the ISO C and MISRA -C groups I have to disagree
with your artificial and incorrect view of topicality on this NG.

I see, so as a member of the ISO C working group, you fail to
understand that the C standard defines the language. Anything defined
in the C standard is part of the C language, and anything not in the C
standard is not part of the language, but a non-standard extension.

You never seemed to be so obtuse before.
If you don't like it not partake of those threads otherwise stop
polluting this NG with your pedantic OT whining.

Surely with your years of usenet experience, you are aware of the fact
that discussions about topicality are ALWAYS topical.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top