Azzera filtri
Azzera filtri

calling dll from MATLAB / making header file

6 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Friedrich
Friedrich il 3 Apr 2014
Modificato: Friedrich il 3 Apr 2014
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.
  2 Commenti
Krzysztof Fajst
Krzysztof Fajst il 3 Apr 2014
yes that true my matlab is 64 bit, I was hoping it will be OK.
Regarding header. What would be a correct syntax ?? I tried
double __stdcall dzBuy(double& sourceArray[] but getting
error C2143: syntax error : missing '{' before '&'
Friedrich
Friedrich il 3 Apr 2014
Modificato: Friedrich il 3 Apr 2014
I would try
double __stdcall dzBuy(double* sourceArray[],double probabiltyValue, int lookBack, int bars, int i );

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by