How to compile a DLL and header file?

4 visualizzazioni (ultimi 30 giorni)
Mohd Harish
Mohd Harish il 5 Mag 2014
Modificato: Chaitra il 25 Giu 2014
I am trying to create a compiled standalone application that uses a DLL driver to work with an FTDI chip. The driver runs on Windows 64 bit. The driver a header file called ftd2xx64.h)
I first tried just adding this file and all my m files into my MATLAB Compiler (R2013b) and compiling. I got an error that my .h file could not be compiled without an "-a" option.
Then I tried compiling the m files by themselves and copy/pasting the .h file into the for_testing folder that was created along with my standalone application. When I tried running the app, I got an error message stating that I need to use a prototype file instead of a header file. MATLAB says I can create a prototype file by using the "loadlibrary" command with an 'mfilename' option.
Is this what I need to do to include this .h file in my app? If so, how do I make this prototype file exactly?

Risposte (1)

Chaitra
Chaitra il 25 Giu 2014
Modificato: Chaitra il 25 Giu 2014
All the files(header or dll or any other files) that are needed by a ".m" file to run can be compiled along with the ".m" file by using -a flag in mcc command.
>> mcc –m foo.m [-a filename...]
You can learn more about the usage of -a flag by executing the following command in MATLAB:
>> docsearch mcc -a
You cannot copy/paste .h file into for_testing folder, because when the compiled application runs it needs to know the location of the header file in memory. Deployable MATLAB files are suspended or frozen at the time MATLAB Compiler encrypts them—they do not change from that point onward. When the application is compiled without the header file, there is no way for the application to determine the physical location of header file in memory.

Categorie

Scopri di più su MATLAB Compiler in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by