Using the C Math Library | ![]() ![]() |
Building an Application
The C source code for the example ex1.c
is included in the <matlab>
/extern/examples/cmath
directory, where <matlab>
represents the top-level directory where MATLAB is installed on your system. To verify that mbuild
is properly configured on your system to create stand-alone applications, copy ex1.c
to your local directory and cd
to that directory. Then, at the UNIX prompt enter:
mbuild ex1.c
This should create the file called ex1
. Stand-alone applications created on UNIX systems do not have any extensions. For answers to some common build problems, see Troubleshooting mbuild.
Locating Shared Libraries
Before you can run your stand-alone application, you must tell the system where the API and C shared libraries reside. This table provides the necessary UNIX commands depending on your system's architecture.
It is convenient to place this command in a startup script such as ~/.cshrc
. Then, the system will be able to locate these shared libraries automatically, and you will not have to re-issue the command at the start of each login session. The best choice is to place the libraries in ~/.login
, which only gets executed once, if that option is available on your system.
Note
On all UNIX platforms, the C libraries are shipped as shared object (.so ) files or shared libraries (.sl ). Any stand-alone application must be able to locate the C libraries along the library path environment variable (SHLIB_PATH , LIBPATH, or LD_LIBRARY_PATH) in order to be loaded. Consequently, to share a stand-alone application with another user, you must provide all of the required shared libraries. For more information about the required shared libraries for UNIX, see Building Microsoft Windows Applications.
|
Running Your Application
To launch your application, enter its name on the command line. For example,
ex1 1 3 5 2 4 6 1.0000 + 7.0000i 4.0000 +10.0000i 2.0000 + 8.0000i 5.0000 +11.0000i 3.0000 + 9.0000i 6.0000 +12.0000i
![]() | Configuring the Build Environment | mbuild Options | ![]() |