No BSD License  

Highlights from
Example of loading C DLL and performance comparison

4.0

4.0 | 2 ratings Rate this file 68 Downloads (last 30 days) File Size: 1.87 KB File ID: #15065

Example of loading C DLL and performance comparison

by Vinesh Bhunjun

 

21 May 2007 (Updated 21 May 2007)

The example shows how to load a C DLL and also compares it with Matlab files

| Watch this File

File Information
Description

This example shows how to load a C DLL into Matlab and make a call to functions it contains. In addition, a C-like M file implementation of the same functionality is included for comparison. Furthermore, a vectorized M file has been added to try to match the performance of the library call.

Files:-
conv.c and conv.h : use these to create the dll called conv.dll

myconvm1 : C-like M file that performs the same thing as myconv in conv.dll

myconvm2 : vectorized M file with performance approaching that of myconv in conv.dll

myscr : script that shows how to load the library and that times the execution times of the different versions

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
24 May 2007 J Mac

Not a bad simple demo, but would be more helpful if it showed passing data back and forth between C dll and Matlab code.

11 Jun 2007 Maurice Stassen

I was looking for a simple example on how to use a C DLL in Matlab. This was exactly what I was looking for. No frills just a simple interface example.

09 Nov 2007 alexander zambrano

i have several .dll that i want to link to a file.m

10 Apr 2008 ras red

dear sir i want to know how can i create a c dll file from c code you give it , and i have three dll created by c charp do you know how can i load their functions to the matlab, i am using matlab2008a

14 Jun 2008 Milan Pipersky

Just what I needed to get started. Something like this should be included in the Help pages, which only use an example of MatLab-generated dll, not one generated externally.

If you are using MSVC 7, be sure to start with and "Empty Project" to avoid all the baggage contained in stdafx, etc.

Thank you Vinesh

29 Oct 2009 Ulf

Nice that it works for other people... I get the following error message:

??? Error using ==> loadlibrary at 387
Call to Perl failed. Possible error processing header file.
Output of Perl command:
Can not open file conv.i because No such file or directory at C:\Program
Files\MATLAB\R2009a\toolbox\matlab\general\private\prototypes.pl line 34

Seems like this conv.i file is not generated as expected? Using Visual C++ 2008 express edition. Any ideas?

Thanks, Ulf

09 Feb 2012 yossi kfir

maybe u forgot to add the dll file?

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
external interface Vinesh Bhunjun 22 Oct 2008 09:13:23
loadlibrary Vinesh Bhunjun 22 Oct 2008 09:13:23
vectorization Vinesh Bhunjun 22 Oct 2008 09:13:23
external code interfacing Vinesh Bhunjun 22 Oct 2008 09:13:23
c dll Vinesh Bhunjun 22 Oct 2008 09:13:23
c dll Raviv 28 Mar 2011 09:03:29
c dll Mark 05 Jul 2011 06:53:35

Contact us at files@mathworks.com