> ## Name

> cgCreateObjFromFile - create a cg object type from a shader file

> ## Synopsis

>     #include <Cg/cg.h>

>     CGobj cgCreateObjFromFile( CGcontext context,
>                                CGenum program_type,
>                                const char * source_file,
>                                CGprofile profile,
>                                const char ** args );

> ## Parameters

> context
>   The context to which the new object will be added.
> program_type
>   An enumerant describing the contents of the source string. The following enumerants are allowed:
>   CG_SOURCE
>     source contains Cg source code.
>   CG_OBJECT
>     source contains object code that resulted from the precompilation of some Cg source code.
> source_file
>   Name of a file containing source or object code. See program_type for more information.
> profile
>   The profile enumerant for the program.
> args
>   If args is not NULL it is assumed to be an array of null-terminated strings that will be passed directly to the compiler as arguments. The last value of the array must be a NULL.

> ## Return Values

> Returns a CGobj handle on success.

> Returns NULL if an error occurs.

> ## Description

> cgCreateObjFromFile creates a new CGobj which is a source code object similar to a .obj or .o in C/C++ programming where various forms of data can be extracted. This can be used, for example, to create user defined data types from a Cg source string.

> ## Examples

>     // To create a Cg obj:

>     CGcontext ctx = cgCreateContext();
>     CGobj structObj = cgCreateObjFromFile(ctx, CG_SOURCE, source_file,
>                                           CG_PROFILE_ARBVP1, NULL);

>     // Now we can get the CGtype:

>     CGtype userDefinedMyType = cgGetNamedUserType(structObj, "MyType");

>     // We could also iterate through all the types in the CGobj printing
>     // their names like this:

>     int numTypes = cgGetNumUserTypes(structObj);
>     for (int i=0; i<numTypes; i++) {
>        cout << cgGetTypeString(cgGetUserType(structObj, i)) << endl;
>     }

> ## Errors

> CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.

> CG_INVALID_ENUMERANT_ERROR is generated if program_type is not CG_SOURCE or CG_OBJECT.

> CG_UNKNOWN_PROFILE_ERROR is generated if profile is not a supported profile.

> CG_COMPILER_ERROR is generated if compilation fails.

> ## History

> cgCreateObjFromFile was introduced in Cg 2.0.

> ## See Also

> cgCreateObj, cgDestroyObj