How do I create a MEX file

转载 2004年07月10日 17:13:00

Solution Number: 31087

Date Last Modified: 2003-12-10
  
Product:    MATLAB 6.1 ==> Current Version
Platform:    Information Not Available

 

Problem Description
How do I create a MEX file using the Microsoft Developer Studio and Compaq Visual Fortran 6.5?

The documentation in the External Interfaces Guide outlines the procedure to do the above in the Visual C++ environment. This document outlines this procedure for Fortran programs in the MSDev IDE.


Solution:
Compiling MEX-Files with the MSDEV IDE for Compaq Visual Fortran 6.5:

To build MEX-files with the MSDEV IDE for Compaq Visual Fortran 6.5:

1. Inside the IDE, go to FILE-->NEW. Select "Fortran Dynamic Link Library". Provide a project name. In the event you do not see this option, please check the installation of Compaq Visual Fortran. There should be an .awx file that should be installed by Compaq Visual Fortran. If not check with Compaq for troubleshooting.

2. Create an empty DLL project.

3. Once the project is created, add the files yprimefg.F and yprimef.F from the $MATLAB/extern/examples/mex/ directory to your project. Here, $MATLAB refers to the root MATLAB directory on your computer.

4. Create a file with extension .DEF and add it to the project (anywhere should be fine; resources for example). The .DEF file should have the following text (if your project name is myproj, then a dll will be created called myproj.dll, used below):


LIBRARY myproj.dll
EXPORTS
_MEXFUNCTION@16


5. Select the menu Project-->Settings... Here, under Fortran, please change the following:
Fortran tab:
a. Category: Fortran Language
Source Form: Force fixed form
Fixed form length: 80 columns
b. Category: External Procedures
External Name Interpretation: Upper case
Argument Passing convention: Default
String Length Argument Passing: After All Args
Link tab:
a. Category Input:
Add these libraries to Object/library modules: libmx.lib libmex.lib libmat.lib ....
Additional library path: <MATLAB>/extern/lib/win32/microsoft/msvc60

6. The above should compile and run and can be run as a MEX file in MATLAB.

We expect that similar steps are performed for Compaq Visual Fortran 6.6. It is not practical, however, for us to offer complete technical support on the details of using any specific one of the large number of IDE environments our customers use. If you need detailed assistance with the particular settings needed to get your IDE environment to generate code that successfully compiles and runs with our products, we suggest you contact the manufacturer of your IDE to get information or expert technical assistance in using it.

 

HDOJ 1040 As Easy As A+B

Problem Description These days, I am thinking about a question, how can I get a problem as easy as ...
  • qq_26525215
  • qq_26525215
  • 2016年02月06日 13:56
  • 587

How do I make games? A Path to Game Development

By Geoff Howland's   When I talk to people looking to get into game development some of the fir...
  • arcticpenguin
  • arcticpenguin
  • 2010年07月12日 17:21
  • 465

How do I create a log file of my installation?

For a specific setup, when launching it Launch your setup with a command line like this: msiexec...
  • snlei
  • snlei
  • 2011年09月21日 17:29
  • 693

LIBSVM的FQA

这里是libsvm的FQA : 我研究了好久才发现有这么个好东西的:转别人的 问: 我在那里能够找到libsvm的文件 ?  软件包中有一个 README 文件,里面详细说明了所有参数选项、...
  • wangpengfei163
  • wangpengfei163
  • 2016年09月06日 15:17
  • 561

How do I rename a data file

在论坛看到一个帖子,说是rename data file 报错了,第一感觉他的语法有问题,也很少用这个命令,就google了一下,发现语法没有问题,可能他的操作顺序有问题。 因为rename的时候数据...
  • tianlesoftware
  • tianlesoftware
  • 2010年04月14日 23:10
  • 4264

SVD在推荐系统中的应用(资源汇总)

关于SVD在推荐系统中的应用一些比较好的资源 博文[1]给出了一个具体的实例分析,能够很好的理解SVD在推荐系统中应用对推荐结果所起的作用。 博文[2]从强调SVD应用到推荐系统领域中的思想出发,详...
  • dajunxing
  • dajunxing
  • 2016年03月27日 22:06
  • 527

mongodb 安装和

MongoDB设置访问权限、设置用户 MongoDB已经使用很长一段时间了,基于MongoDB的数据存储也一直没有使用到权限访问(MongoDB默认设置为无权限访问限制),今天特地花了一点时间研...
  • wu_jing_sheng0
  • wu_jing_sheng0
  • 2016年06月19日 15:53
  • 141

HDU3605 Escape(网络流,最大流,状态压缩,ISAP算法)

Problem Description 2012 If this is the end of the world how to do? I do not know how. But no...
  • riba2534
  • riba2534
  • 2018年01月11日 21:32
  • 60

How do I reset Windows Update components?

How do I reset Windows Update components? Email  PrintAll Products Windows 8.1, Windows 8, and Win...
  • hadstj
  • hadstj
  • 2015年07月07日 20:26
  • 650

Escape (SAP模板)

2012 If this is the end of the world how to do? I do not know how. But now scientists have found tha...
  • xiaoxiede_wo
  • xiaoxiede_wo
  • 2018年01月16日 16:55
  • 14
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How do I create a MEX file
举报原因:
原因补充:

(最多只允许输入30个字)