I have two files: File1 (ado) for an estimation command, and File2 (mata) for the mata based ml estimation function. File2 has mata mlib lines to create a library, and when I compile File2 on my computer, File1 works well. File1 would only work if File2 is run at least once by the user.
I want to make this program available to other users on SSC, and I know about how to upload ado files on SSC, but I am not sure how to upload an ado file on SSC that relies on the compilation of a mata file. How is it generally done? Do you put those two files in a folder and a readme text file to tell the user to compile the mata file first? Or, when you install a package from SSC, does it automatically compile the mata file for the user so that the ado file would work without a need to manually compile the mata file first? Or do you do something in File1 so that File1 would compile File2 when File1 is run by the user?
Below is a simplified example:
I want to make this program available to other users on SSC, and I know about how to upload ado files on SSC, but I am not sure how to upload an ado file on SSC that relies on the compilation of a mata file. How is it generally done? Do you put those two files in a folder and a readme text file to tell the user to compile the mata file first? Or, when you install a package from SSC, does it automatically compile the mata file for the user so that the ado file would work without a need to manually compile the mata file first? Or do you do something in File1 so that File1 would compile File2 when File1 is run by the user?
Below is a simplified example:
Code:
// File1 (ado) ... program Estimate, eclass ... ml model lf myprob() (...) ml max ... end // File2 (mata) mata: void myprob(transmorphic scalar ML, real rowvector b, real colvector lnfj) { depvar = moptimize_util_depvar(ML, 1) xb = moptimize_util_xb(ML,b,1) lnfj = ... } end mata: mata mlib create lmyprob, dir(PLUS) replace mata: mata mlib add lmyprob myprob(), dir(PLUS)
Comment