How to Compile function in package folder?

I have a folder, +crr, with a function, fast_scenario_delete.m, inside it. I would like to make fast_scenario_delete.exe. This function depends on the database toolbox and associated .jar file, and I want the output .exe file in a particular folder, so I tried:
>>mcc -m crr.fast_scenario_delete.m -o fast_scenario_delete -d ..\bin\win32 -a mysql\driver_file.jar
I get this error (in addition to other warnings that I always get):
Depfun error: 'Unable to locate crr.fast_scenario_delete.m as a function on the MATLAB path'
I tried a few other things, but they all fail because I can't add the +crr folder to the path.
For now, I have just copied the function out of the package and compiled it that way, but that really defeats the purpose of having packages. Is there a way to compile a function that is in a package folder?

3 Comments

Does anyone know if this problem has been fixed in the intervening 8+ years since this question was asked?
You have a folder with a "+" in the folder name also? Or an extra dot in the filename?
This is by design, and will not be changed.
You need to have a function that invokes the package -- just like it is not possible to directly compile a class and need to instead have a function that invokes the class.

Sign in to comment.

Answers (3)

That dot in crr.fast_scenario_delete.m looks strange to me. I've never tried to compile m-files with a dot in the name. Usually the m-file has the same name as the function inside it, which doesn't have a dot. Can you rename it and try it again?
What is the "Current Folder" shown in MATLAB when you execute the mcc command?
owr
owr on 6 Jan 2012
I regularly compile functions in packages - my packages consist of several classes each and the functions are methods of these classes. However, I have never tried to compile the package itself. Rather I have about 5 "regular" functions that utilize the classes in the underlying packages. These regular functions are added to a project that is deployed as a .NET dll using the Compiler and Builder NE.
This may not align with your use case but thought I'd mention it as a data point.
You need a driver routine, even if all that driver routine does is call the package.

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Asked:

on 6 Jan 2012

Commented:

on 20 Apr 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!