how can i install borland for mexfile?

3 visualizaciones (últimos 30 días)
ramik
ramik el 25 de Mayo de 2022
Respondida: Jan el 25 de Mayo de 2022
hi, i should install the compiler borland 5.5 on my matlab 2007b inorder to compile mex file.
after i installed on my pc, i try to run the command 'mex -setup' i can't find the borland compiler in the compiler's list .
please can anyone help me to solve the problem.

Respuesta aceptada

Jan
Jan el 25 de Mayo de 2022
mex -setup create a ".bat" file, which has the syntax of a Windows batch script, but is interpreted by PERL - one of the strangest possible ideas. Instead of letting Matlab create this file, you can do this by your own. With Matlab R6.5 and BCC5.5 I've used:
@echo off
rem BCC55FREEOPTS.BAT
rem
rem Compile and link options used for building MEX-files
rem with the Borland C compiler
rem
rem Created automatically from bcc55opts.bat, Matlab 6.5.1
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************
set MATLAB=%MATLAB%
set BORLAND=C:\Programme\BCC55
set PATH=%BORLAND%\BIN;%MATLAB_BIN%;%PATH%
set INCLUDE=%BORLAND%\INCLUDE
set LIB=%BORLAND%\LIB
set PERL="%MATLAB%\sys\perl\win32\bin\perl.exe"
rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=bcc32
rem JSim - orig: set COMPFLAGS=-c -3 -P- -w- -pc -a8 -I"%INCLUDE%" -DMATLAB_MEX_FILE
set COMPFLAGS=-c -P- -w -WD -pc -a8 -I"%INCLUDE%" -DMATLAB_MEX_FILE -DCOMPILER_=BCC5.5
rem JSim - orig: set OPTIMFLAGS=-O2 -DNDEBUG
set OPTIMFLAGS=-DNDEBUG -6 -Oi -OS -Ov -ff -O2
set DEBUGFLAGS=-v
set NAME_OBJECT=-o
rem ********************************************************************
rem Library creation command
rem ********************************************************************
set PRELINK_CMDS1=copy "%MATLAB%\extern\lib\win32\borland\%ENTRYPOINT%.def" "%OUTDIR%%MEX_NAME%.def"
rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\borland\bc54
set LINKER=%PERL% %MATLAB_BIN%\link_borland_mex.pl
set LINKFLAGS=-aa -c -Tpd -x -Gn -L\"%BORLAND%\"\lib -L\"%BORLAND%\"\lib\PSDK -L\"%LIBLOC%\" libmx.lib libmex.lib libmatlb.lib libmat.lib c0d32.obj import32.lib cw32mt.lib "%OUTDIR%%MEX_NAME%.def"
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=-v
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT="%OUTDIR%%MEX_NAME%".dll
set RSP_FILE_INDICATOR=@
rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=brcc32 -w32 -D_NO_VCL -fomexversion.res
set RC_LINKER=
set POSTLINK_CMDS=del "%OUTDIR%%MEX_NAME%.def"
rem ********************************************************************
rem Define version for CompileMex (Jan Simon)
rem ********************************************************************
set COMPILERVER=Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
Store this as "D:\mex_BCC.bat" and call mex as:
mex('-O', '-f', 'D:\mex_BCC.bat', 'yourFunc.c')
The LAPACK libraries shipped with BCC crash when called from Matlab MEX files. If you observe this, you can replaced them with the attached ones.
I've downloaded LCC v2 and v3 from the internet as well as OpenWatcom. I've attached the corresponding BAT files also. Adjust the path to the compiler accordingly (the line: "set BORLAND=C:\Programme\BCC55").
I've created the files by modifying the BAT files shipped with Matlab manually until they worked. The attached scripts ran with Matlab 6.5, not R2007b, but if there are differences, they should be small: Compare the original BAT files shipped with the different Matlab versions and adjust the modified BAT files accordingly.
Good luck!

Más respuestas (0)

Categorías

Más información sobre Write C Functions Callable from MATLAB (MEX Files) en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by