Using C Header files with loadlibrary

2 views (last 30 days)
Lab Rat
Lab Rat on 8 Apr 2014
Edited: Philip Borghesani on 8 Apr 2014
Hi,
We are trying to use a dll file provided by FTDI in order to communicate with an FTDI chip which in turn uses I2C to communicate with the dut. We are trying to use the dll as well as the header files provided by FTDI. However, we seem to receiving the following warnings:
Type 'PVOID' was not found. Defaulting to type error.
Found on line 31 of input from line 59 of file C:\Program Files\MATLAB\R2010a\ftd2xx.h
Type 'ULONG' was not found. Defaulting to type error.
Found on line 32 of input from line 60 of file C:\Program Files\MATLAB\R2010a\ftd2xx.h
Type 'ULONG' was not found. Defaulting to type error.
Found on line 161 of input from line 189 of file C:\Program Files\MATLAB\R2010a\ftd2xx.h
Type 'WORD' was not found. Defaulting to type error.
Found on line 628 of input from line 656 of file C:\Program Files\MATLAB\R2010a\ftd2xx.h
Type 'WORD' was not found. Defaulting to type error.
Found on line 628 of input from line 656 of file C:\Program Files\MATLAB\R2010a\ftd2xx.h
Type 'WORD' was not found. Defaulting to type error.
Found on line 628 of input from line 656 of file C:\Program Files\MATLAB\R2010a\ftd2xx.h
Type 'WORD' was not found. Defaulting to type error.
Found on line 628 of input from line 656 of file C:\Program Files\MATLAB\R2010a\ftd2xx.h
We found the datatypes to be in the windows.h header file so we are trying to use the windows.h header file using the following line:
[warnings notfound] = loadlibrary('libMPSSE.dll","libMPSSE_I2C.h",'addheader','windows');
But we still seem to see the warnings. Some of the data structures in the dll require the datatypes so we are running into issues with it. Can someone give us any pointers ?

Answers (1)

Philip Borghesani
Philip Borghesani on 8 Apr 2014
Edited: Philip Borghesani on 8 Apr 2014
You are making a common mistake interpreting the functionality of the addheader function. It will not help in this situation, the documentation attempts to make that clear. You must edit libMPSSE_I2C.h to add an include statement for windows.h or create a new header (myheader.h) containing:
#include <windows.h>
#include <libMPSSE_I2C.h>
Then issue
[warnings notfound] = loadlibrary('libMPSSE.dll","myheader",'addheader','libMPSSE_I2C');
The addheader function tells loadlibrary look for functions in a #included header file as well as in the main header file used with loadlibrary.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!