I am trying to load ReadFile from kernel32 using the loadlibrary function. I created a header file:
#ifndef _MATLAB_READFILE_H_ #define _MATLAB_READFILE_H_ #include <windows.h> #define DLL_EXPORT __declspec(dllexport) #ifdef __cplusplus extern "C" { #endif DLL_EXPORT BOOL _stdcall ReadFile(DWORD hFile, DWORD * data, DWORD numbytesToRead, DWORD * pnumbytesRead, DWORD overlapped); DLL_EXPORT BOOL _stdcall ReadFile(DWORD hFile, double * data, DWORD numbytesToRead, DWORD * pnumbytesRead, DWORD overlapped); DLL_EXPORT BOOL _stdcall ReadFile(DWORD hFile, char * data, DWORD numbytesToRead, DWORD * pnumbytesRead, DWORD overlapped); #ifdef __cplusplus } #endif #endif
So, that I can easily read different file types without converting data types. However the LoadLibrary function only loads the last ReadFile declaration.
Best Answer