Monday, 15 June 2015

Linking MATLAB to a DLL library -



Linking MATLAB to a DLL library -

i trying execute illustration code matlab toolkit, 'oscmex'. toolkit allows communication using osc protocol on matlab. presume question non-specific; should apply any toolkit set-up in manner 1 is.

reasons aside, i'm having simple problem getting toolkit , running. toolkit comes no documentation whatsoever; set of 6 dll files (in 1 directory), , set of 4 matlab '.m' illustration code files (in directory). every toolkit i've used in past has either been built-in kit or has had intuitive (semi-automated) install procedure.

after downloading toolkit, first thing tried run 1 of '.m' illustration codes. failed first line of code contained function osc(), not (currently) recognised matlab.

so, figured maybe need move '.m' files same folder dlls; perhaps matlab see functions within dlls. no dice.

so, realise have somehow link matlab dlls on startup. tried adding dlls folder , adding entry in 'pathdef.m' file. failed.

i've read somewhere can load dll file using loadlibrary() function. so, tried doing dll files. failed on first file:

>> loadlibrary('osc_free_address.dll') error using loadlibrary>lfullpath (line 587) not find file osc_free_address.h.

i'm starting run out of options... how can set of dlls , running?

browsing library's web page seems these dlls old form of mex files. therefore, should not used in context of shared library (e.g., using loadlibrary , calllib), rather compiled straight mex files.

to so, suggest next steps:

make sure have working mex compiler configured matlab. in matlab, type:

>> mex -setup

this guide through configuration process. understand working on windows machine, work visual studio compiler - works best me.

this library's readme file suggests osc

requires liblo 0.22 or later. see http://plugin.org.uk/liblo/

make sure have library , located in ld_library_path (see e.g., this question details, or mex docs).

get source code osc library their repository.

compile sources in matlab using

>> mex -o -largearraydims osc_free_address.c >> mex -o -largearraydims osc_free_server.c

and on 7 c source files. after mex-ing c files you'll have mex files can run matlab if regular functions. may find useful utilize library's create file, suggested andrew mao.

good luck,

matlab dll

No comments:

Post a Comment