You need to write a mexFunction() as the interface, just like main() function as the interface of the program and the calling environment. Use mex to compile the codes and call the filename including mexFunction() within Matlab just like the filename is a Matlab function.