How to Compile function in package folder?

2 visualizaciones (últimos 30 días)
Steve
Steve el 6 de En. de 2012
Comentada: Walter Roberson el 20 de Abr. de 2020
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 comentarios
Image Analyst
Image Analyst el 20 de Abr. de 2020
You have a folder with a "+" in the folder name also? Or an extra dot in the filename?
Walter Roberson
Walter Roberson el 20 de Abr. de 2020
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.

Iniciar sesión para comentar.

Respuestas (3)

Image Analyst
Image Analyst el 6 de En. de 2012
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 el 6 de En. de 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.

Walter Roberson
Walter Roberson el 6 de En. de 2012
You need a driver routine, even if all that driver routine does is call the package.

Categorías

Más información sobre MATLAB Compiler en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by