Sample C Program to Compile a Project

The program below is used to compile a project.

... 
#include "c8client.h" 
#include "c8compiler.h" 
int main(int argc, char **argv) 
{ 
    /* 
     * This is an example of using the Sybase CEP C API 
     * to compile CCL programs. 
     */ 
    int ret = 0; 
    // The value (C8_OK or C8_FAIL) returned by C8Compile() 
    int r; 
    const char * ccl = "pass-through.ccl"; 
    const char * ccx = "pass-through.ccx"; 
    const char * workspace = "Default"; 
    C8CompilerOptions * opts = 0; 
    /* You must initialize the client library before calling 
     * C8Compile() or any other methods from the Client SDK! 
     */ 
    if (C8_OK != C8ClientSDKInitialize(argv[0], 0)) { 
        return -1; 
    } 
    /* get default compiler options. */ 
    opts = C8CompilerOptionsCreate(); 
    /* To demonstrate how to set compiler options, 
     * let's tell the compiler to compile in release mode. 
     * To use default compiler options, it is safe to 
     * just pass NULL. 
     */ 
    C8CompilerOptionsSetDebugMode(opts, C8_FALSE); 
    r = C8Compile(ccl,        // Input file name (e.g. foo.ccl) 
                  ccx,        // Output file name (e.g. foo.ccx) 
                  workspace,  // Name of workspace foo will run in. 
                  "",         // No need to load this under a name 
                              //    other than foo. 
                  opts        // Compiler options 
                  ); 
    if (r = C8_OK) { 
        ret = 0; 
        printf ("Compilation successful!\n"); 
    } else { 
        /* try printing out the actual compiler error */ 
        C8SizeType l_errtxtlen = C8ErrorGetMessageLength(); 
        ret = -1; 
        printf ("Compilation failed.\n"); 
        if (l_errtxtlen > 0) { 
            C8Char * l_errbuf = (C8Char *) C8Malloc(l_errtxtlen); 
            C8ErrorGetMessageText(l_errbuf, l_errtxtlen); 
            printf("Error message: %s\n", l_errbuf); 
            C8Free(l_errbuf); 
        } 
    } 
    /* don't forget to free the compiler options */ 
    if (opts) 
        C8CompilerOptionsDestroy(opts); 
    /* and shut down the library */ 
    if (C8ClientSDKShutdown() != C8_OK) { 
        /* could not shut down the library */ 
        ret = -1; 
    } 
    return ret; 
}

To compile this, follow the instructions that were given for compiling the "register query" example at the end of Example.