Wednesday, June 4, 2008

Compiling Matlab code into Shared Libraries

It's been a long time since our last post. Many things have happened since, and even though we intended to use this blog as a progress report log, I am starting to realize that it will be more similar to a "Lessons Learned" kind of log, at least during the early stages.

Today I spent a few hours trying to get some .m files working in LabView by compiling them into .dll shared libraries, and importing them using the new Shared Library Import Wizard that came out on v8.2 of LabView. Read lots of forum threads, and spent some time staring at the command line prompt.

So far, I've managed to compile the code by using the following:

mcc -a neededmatfiles.mat -W lib:libraryName -T link:lib filestocomiple.m

This results in a .dll and some other necessary files.

It turns out, however, that the choice of compiler (which can be configured using "mbuild -setup" is an important one. The Lcc-win32 compiler that comes with Matlab doesn't seem to be doing the work, and I've read on some forums that the Visual Studio 7.0 compiler is our best bet. So now I'm looking for a computer with it, since the "free" student version (DreamSpark) is not so easy to get.

Update (06/06/08): I might have found the solution here:
http://forums.ni.com/attachments/ni/170/7347/1/dllmatlablabview.pdf

No comments: