Keywords: clamdoc

Next: Database reloading Up: API Previous: Error handling Contents

### Engine structure

When all required databases are loaded you should prepare the detection engine by calling `cl_build`. In the case of failure you should free the memory occupied by the engine with `cl_free`:

    	int cl_build(struct cl_engine *engine);
    	void cl_free(struct cl_engine *engine);

In our example:

    	if((ret = cl_build(engine))) {
    	    printf("cl_build() error: %s\n", cl_strerror(ret));
    	    cl_free(engine);
    	    exit(1);
    	}