see comments in code:
ushort *graydata = NULL; //[10*10]; no need to initialize since detecFaces allocates the memory.
bool okLoad = mylib.load();
//You should really check for errors!
if(!okLoad){
//handle error
return;
}
bool loaded = mylib.isLoaded();
if(!loaded){
//TDOD: handle error
return;
}
typedef void (*FdetectFace)(ushort*,int,int,int);
FdetectFace detectFace = (FdetectFace)mylib.resolve("fdlib_detectfaces");
if(detectFace ){
//app crashes here
detectFace(graydata,10,10,0);
}
//at some point you should release the data allocted in detectFace:
if(graydata)
delete graydata;
ushort *graydata = NULL; //[10*10]; no need to initialize since detecFaces allocates the memory.
QLibrary mylib("\\fdlib.dll");
bool okLoad = mylib.load();
//You should really check for errors!
if(!okLoad){
//handle error
return;
}
bool loaded = mylib.isLoaded();
if(!loaded){
//TDOD: handle error
return;
}
typedef void (*FdetectFace)(ushort*,int,int,int);
FdetectFace detectFace = (FdetectFace)mylib.resolve("fdlib_detectfaces");
if(detectFace ){
//app crashes here
detectFace(graydata,10,10,0);
}
//at some point you should release the data allocted in detectFace:
if(graydata)
delete graydata;
To copy to clipboard, switch view to plain text mode
unsafe public static extern void fdlib_detectfaces(ushort*data,int w,int h,int threshold);
unsafe
{
UInt16[] image = new ushort[10 * 10];
fixed (ushort* ptr = &image[0])
{
//app works fine here
fdlib_detectfaces(ptr, 10, 10, 0); //this calls recursively - does nothing, and never ends!! which is probably why it crashes.
}
}
unsafe public static extern void fdlib_detectfaces(ushort*data,int w,int h,int threshold);
unsafe
{
UInt16[] image = new ushort[10 * 10];
fixed (ushort* ptr = &image[0])
{
//app works fine here
fdlib_detectfaces(ptr, 10, 10, 0); //this calls recursively - does nothing, and never ends!! which is probably why it crashes.
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks