First, compile the "amplsolv.lib" according to my last blog.
Then, compile the "amplfunc.dll" and "funcadd.obj" in the subdirectory "funclink". (Download from https://ampl.com/netlib/ampl/solvers/funclink/index.html)
Copy the DLL and OBJ files into the "solver" folder so that they can be seen when compiling in MATLAB.
Download "amplfunc.c" and "spamfunc.c" from https://ampl.com/netlib/ampl/solvers/examples/index.html
Put them in the same folder "solver".
Start MATLAB, navigate to the folder "solver", use the command "mex amplfunc.c amplsolv.lib" and "mex spamfunc.c amplsolv.lib".
If success, the "amplfunc.mexw64" and "spamfunc.mexw64" can be seen in the current folder.