Is it possible to create a CGI executable which calls a shared library using the MATLAB Compiler to deploy my application on the Web?

1 view (last 30 days)
I want to deploy my application on the Web. I want to compile my MATLAB application in to a shared library and write the CGI application in C.

Answers (2)

Sanchali Purandare
Sanchali Purandare on 16 Jan 2011
Using MATLAB Compiler you can create a shared library which can be called from an executable written in C. This executable can be called by your Web server using the Common Gateway Interface (CGI).
Before attempting the following, you should verify that you have configured your Web server properly in order to run CGI programs, and that you are able to execute a CGI program that is independent of MATLAB. Consult your Web server documentation for how to do this.
An example has been created which demonstrates how to do this. The files for this example are located in the file CGI_Library.zip which can be downloaded from the bottom of this page. Perform the following steps to compile and run this example:
1. Compile the MATLAB file into a shared library. This can be done with the following command in MATLAB:
mcc -B csharedlib:libmymagic mymagic.m
2. Compile the C-file into an EXE-file which links to the library created in step 1. This can be done with the following command in MATLAB:
mbuild magicsquare.c libmymagic.lib
3. Copy HTML file to the Web server and place them in a directory with the proper permissions. Consult your Web server documentation for how to do this.
4. Copy the DLL, EXE, and CTF files to the Web server and place them in the "/cgi-bin" directory of your website. You will need to configure the Web server to have the proper permissions to be able to execute the EXE-file. Consult your Web server documentation for how to do this.
5. Install the MCR on the web server. For more information, see the "Deployment Process" section in the documentation by following the link at the bottom of this page.
6. Execute the application for the first time from the web server system itself in order to force the CTF-archive extraction.
7. Load the HTML-file in a web browser from the remote computer and submit the form to execute the CGI program.
For more information on shared libraries, see the MATLAB Compiler documentation and C shared library example:

Aurelien Queffurust
Aurelien Queffurust on 3 Jun 2016
Sorry where are the files, it is not clear where to find the zip file?

Categories

Find more on Application Deployment in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!