How can I use a DLL with Matlab when I cannot install a C compiler?

Often, you use DLL's to control some hardware, e.g. FTDI's USB interfaces. The DLL's that come with such devices typically do not need a compiler to be installed somewhere, and I don't want to install a C compiler just to interface to a miscellanous piece of hardware. (By the way, it's easy enough to make a DLL that does not need a compiler's distribution package.) How do you interface to such a DLL without having to install a complete computer package? I've tried with 'mex -setup', but I don't seem to get things running this way without a compiler.

답변 (2개)

Philip Borghesani
Philip Borghesani 2013년 8월 8일

1 개 추천

If you use the "mfilename" option to loadlibrary on the first computer to produce a prototype file (and thunk file if using 64 bit MATLAB) then use those on the second computer a compiler will not be needed.
Andreas Goser
Andreas Goser 2013년 8월 7일
편집: Andreas Goser 2013년 8월 7일

0 개 추천

mex -setup needs a C compiler as this is actually the command for setting up one.
Why do you think you need one?
And in case you really need one: Why can't you install one? There are free ones supported.

댓글 수: 1

I don't need a compiler, I just want to use a DLL (on a colleague's computer). But to use a DLL, you must load it using 'loadlibrary', which refuses to load unless you first select a C compiler using 'mex'. I strongly sympathise with Matlab's idea of selecting a C compiler, because it avoids the well known problem of 'DLL hell'. But if you have a DLL that does not refer to e.g. a runtime DLL, having to install a compiler is a nuisance.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

질문:

2013년 8월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by