<!-- Converted to DocBook/SGML by Kevin Conder -->
<section id="CscoreCompile">
  <title>Compiling a Cscore Program</title>

  <para>
    A <emphasis>Cscore</emphasis> program can be invoked either as a Standalone program or as part of Csound:
    <informalexample>
      <screen>
<emphasis>cscore -U pvanal</emphasis> scorename outfilename
      </screen>
    </informalexample>

    or

    <informalexample>
      <screen>
<emphasis>csound</emphasis> -C [otherflags] orchname scorename
      </screen>
    </informalexample>
  </para>

  <para>
    To create a standalone program, write a <emphasis>cscore.c</emphasis> program as shown above and test compile it with '<emphasis>cc cscore.c'</emphasis>. If the compiler cannot find &quot;<emphasis>cscore.h</emphasis>&quot;, try using <emphasis>-I/usr/local/include</emphasis>, or just copy the <emphasis>cscore.h </emphasis>module from the Csound source directory into your own. There will still be unresolved references, so you must now link your program with certain Csound<emphasis> </emphasis>I/O modules. If your<emphasis> </emphasis>Csound installation has created a <emphasis>libcscore.a</emphasis>, you can type

    <informalexample>
      <screen>
cc -o cscore.c -lcscore
      </screen>
    </informalexample>

    Else set an environment variable to a Csound directory containing the already compiled modules, and invoke them explicitly:

    <informalexample>
      <screen>
setenv CSOUND /ti/u/bv/Csound
  cc -o cscore cscore.c $CSOUND/cscoremain.o $CSOUND/cscorefns.o \
    $CSOUND/rdscore.o $CSOUND/memalloc.o
      </screen>
    </informalexample>
  </para>

  <para>
    The resulting executable can be applied to an input scorefilein by typing:

    <informalexample>
      <screen>
cscore scorefilein scorefileout
      </screen>
    </informalexample>
  </para>

  <para>
    To operate from CSound, first proceed as above then link your program to a complete set of Csound<emphasis> </emphasis>modules. If your Csound installation has created a <emphasis>libcsound.a</emphasis>, you can do this by typing

    <informalexample>
      <screen>
cc -o mycsound cscore.o -lcsounc -lX11 -lm (X11 if your installation included it)
      </screen>
    </informalexample>

    Else copy <emphasis>*.c, *.h</emphasis> and <emphasis>Makefile</emphasis> from the Csound source directory, replace <emphasis>cscore.c</emphasis> by your own, then run <quote><userinput>make CSound</userinput></quote>. The resulting executable is your own special Csound, usable as above. The <link linkend="FlagsMinusUpperC"><citetitle>-C flag</citetitle></link> will invoke your <emphasis>Cscore</emphasis> program after the input score is sorted into <quote><emphasis>score.srt</emphasis></quote>. With no <emphasis>lplay</emphasis>, the subsequent stages of processing can be seen in the files <quote><emphasis>cscore.out</emphasis></quote> and <quote><emphasis>cscore.srt</emphasis></quote>.
  </para>
</section>
