fox,>Seems Matlab C/C++ graphics library is only officially supported to generate stand alone executable, not DLL. It is true that is not officially supported but it works nevertheless without any problems.>To compile into DLL, they recommend to use COM builder.You do not need it. All you need is the Matlab compiler.Here is a simple example:------------------function sinPlot;t = [-pi:0.1:+pi];plot(sin(t));return;------------------Compile this in Matlab to a DLL:>> mcc -t -L C -W libhg:sinPlotDll -T link:lib -h sinPlot.m libmmfile.mlibThis gives you the following output files:sinplot.hsinplot.csinplotdll.csinplotdll.hsinplotdll.exportssinplotdll.mlibsinPlotDll.dllsinPlotDll.libsinPlotDll.expNow construct a new C/C++ Win32 console project in MSVC.-------------#include "sinplotdll.h"#include "matlab.h"#include <stdio.h>void main(void){/* Call the library initialization function */sinPlotDllInitialize(); /* Call the implementation function */mlfSinplot();/* Call the library termination function */sinPlotDllTerminate();}----------The exact settings and imports you have to use can be foundon:
http://www.mathworks.com/support/soluti ... =1-18CBIIt is crucial that you read this document carefully and really set all compiler-switchesetc. as described.A final note of caution: Check for case sensitivity. In the example above, sinPlotDllInitialize(); and sinPlotDllTerminate(); start with a lowercase "s" and mlfSinplot(); has to be written in exactly this way.To find out the exact spelling necessary look at sinplotdll.h, where you find functiondefinitions generated by Matlab compiler:extern void InitializeModule_sinplotdll(void);extern void TerminateModule_sinplotdll(void);extern void mlfSinplot(void);extern void mlxSinplot(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);extern void sinPlotDllInitialize(void);extern void sinPlotDllTerminate(void);Finally, be sure to place sinPlotDll.dll in a directory on your system path or in the diretorywhere you execute your exe.I hope this solves your problem. If you have problems replicating this solution, I can sendyou the project files (mail: erkinger_at_gloriosia.com)Hans-Marc Erkingerwww.gloriosia.com - home of Trading with Matlab