calling dll from MATLAB / making header file
2 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm trying to load dll to MATLAB but unfortunatelly I dont have original header file for it. On the other hand I know that in another C like language this dll is imported like this
#import "dynamicZone.dll"
double dzBuy(double& sourceArray[],double probabiltyValue, int lookBack, int bars, int i );
double dzSell(double& sourceArray[],double probabiltyValue, int lookBack, int bars, int i );
#import
so I created my header file like this
#ifndef dynamicZone
#define dynamicZone
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Functions and data types defined... */
double __stdcall dzBuy(double * sourceArray[],double * probabiltyValue, int * lookBack, int * bars, int * i );
double __stdcall dzSell(double * sourceArray[],double * probabiltyValue, int * lookBack, int * bars, int * i );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
but when I try to load it I get 'dynamicZone.dll is not a valid Win32 application'. Is it maybe that I used * in double& sourceArray[] ??
Any idea ??
Krzysztof
0 个评论
采纳的回答
Friedrich
2014-4-3
编辑:Friedrich
2014-4-3
Hi,
the error "not a valid Win32 application" indicates a bittedness missmatch. Either the DLL is a 32bit DLL and you try to load it into a 64bit MATLAB or the DLL is 64bit and you try to load it into a 32bit MATLAB. This will not work. You have to make sure that the bittedness of MATLAB and the DLL is the same.
In addition your created header file is wrong, e.g . probabiltyValue is passsed in as value and not as reference.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!