Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

compiling a DLL to be used in Matlab

$
0
0
Hi,
I am trying to use Matlab compiler to generate a DLL including some functions which I would like to use later on in Matlab by e.g. calllib commands.
I have the the following:
Matlab+Matlab Compiler 2012b
I have installed the SDK 7.1 (and .NET 4.0)

Here is my test m-file for which I am trying to get going:
function [a]=test(input1)
a=input1;

then I run:
mcc -l test.m
and select the SDK compiler for msbuild. As out put I get the expected files including: test.dll and test.h

if I run:
loadlibrary('test','test.h')

i get the following warnings:
>> loadlibrary('test','test.h')
Warning: Warnings messages were produced while parsing. Check the functions you intend
to use for correctness. Warning text can be viewed using:
 [notfound,warnings]=loadlibrary(...)
> In loadlibrary at 344
Warning: The data type 'FcnPtr' used by function testInitializeWithHandlers does not
exist.
> In loadlibrary at 403
Warning: The data type 'FcnPtr' used by function testInitializeWithHandlers does not
exist.
> In loadlibrary at 403

To my surprice my original function test with one input argument, now expects three input arguments:
[uint8, MATLAB arrayPtr, MATLAB array] mlfTest (int32, MATLAB arrayPtr, MATLAB array)

So when making a small test program it fails:
loadlibrary('test','test.h')
calllib('test','testInitialize')
[a]=calllib('test','mlfTest',10)
calllib('test','testTerminate')

Error using calllib
No method with matching signature.
Error in runtest (line 4)
[a]=calllib('test','mlfTest',10)

if I just add two more inputs [a]=calllib('test','mlfTest',10,10,10)
it runs but the output is zero.

Could anyone explain how to get going with this?
If anyone have a working example for making a DLL (in the same environment) and correctly calling that in a Matlab program I would be grateful.

Regrads,
Mathias

Viewing all articles
Browse latest Browse all 19628

Trending Articles