Prev: seeking help on logic expression
Next: Reading a large mixed CSV file of unknown types and size
From: Philip Borghesani on 22 Jun 2010 12:11 Do not assign a return value to phAcqDesc the original object must exist for the duration of the program. You are making it too complicated try this: loadlibrary('xisl','Acq.h'); % phAcqDesc is a pointer to a handle (hAcqDesc) phAcqDesc = libpointer('voidPtr', uint32(0)); % HACQDESC *phAcqDesc % these datatype conversions are not needed dwChannelType = uint32(1); % DWORD dwChannelType nChannelNr = int32(0); % int nChannelNr, bEnableIRQ = int32(0); % BOOL bEnableIRQ Rows = uint32(256); % UINT Rows Columns = uint32(256); % UINT Columns, dwSortFlags = uint32(2); % UINT dwSortFlags bSelfInit = int32(1); % BOOL bSelfInit bAlwaysOpen = int32(1); % BOOL bAlwaysOpen nRet = calllib('xisl','Acquisition_Init', phAcqDesc, ... dwChannelType, nChannelNr, ... bEnableIRQ, ... Rows, Columns, ... dwSortFlags, ... bSelfInit, bAlwaysOpen); % Let MATLAB deal with data types when not using libpointers nRet= calllib('xisl','Acquisition_SetCameraMode', hAcqDesc,0); %if that errors try: % MATLAB knows the datatype of the original phAcqDisc nRet= calllib('xisl','Acquisition_SetCameraMode', hAcqDesc.value,0);
From: kees de Kapper on 23 Jun 2010 04:23 Hi Phil (and others who are following this thread), thank you for your help, but I'm still confused. Adding your advice, the following matlab-code is the summary what we are talking about, aint it? loadlibrary('xisl','Acq.h'); phAcqDesc = libpointer('voidPtr', uint32(0)); % C++CALL: Acquisition_Init(&hAcqDesc, 1, 0, 0, 256, 256, 2, 1, 1); nRet = calllib('xisl','Acquisition_Init', phAcqDesc, 1, 0, 0, 256, 256, 2, 1, 1); % C++CALL: Acquisition_SetCameraMode(hAcqDesc,0); nRet= calllib('xisl','Acquisition_SetCameraMode', phAcqDesc.value,0); But the last line still crashes. I was thinking if it could be that the handle was also a pointer to a struct or something, set by the DLL. Therfore, I tried the following, but that crashes too. hAcqDesc = libpointer('voidPtr', uint32(0)); phAcqDesc = libpointer('voidPtrPtr', hAcqDesc); % C++CALL: Acquisition_Init(&hAcqDesc, 1, 0, 0, 256, 256, 2, 1, 1); nRet = calllib('xisl','Acquisition_Init', phAcqDesc, 1, 0, 0, 256, 256, 2, 1, 1); % C++CALL: Acquisition_SetCameraMode(hAcqDesc,0); nRet= calllib('xisl','Acquisition_SetCameraMode', phAcqDesc.value,0); Probably, the last attempt was just a stupid trial-and-error, but I'm without any ideas. Hope you could help me further. Thanx. Kees
From: Philip Borghesani on 23 Jun 2010 10:58 "kees de Kapper" <kees_de_kapper(a)hotmail.com> wrote in message news:hvsg9p$drf$1(a)fred.mathworks.com... > Hi Phil (and others who are following this thread), > > thank you for your help, but I'm still confused. > > Adding your advice, the following matlab-code is the summary what we are talking about, aint it? > > loadlibrary('xisl','Acq.h'); > > phAcqDesc = libpointer('voidPtr', uint32(0)); > % C++CALL: Acquisition_Init(&hAcqDesc, 1, 0, 0, 256, 256, 2, 1, 1); > nRet = calllib('xisl','Acquisition_Init', phAcqDesc, 1, 0, 0, 256, 256, 2, 1, 1); > > % C++CALL: Acquisition_SetCameraMode(hAcqDesc,0); > nRet= calllib('xisl','Acquisition_SetCameraMode', phAcqDesc.value,0); > > But the last line still crashes. I see nothing wrong here. This should not be so difficult something else is going wrong. What version of MATLAB are you using? Are there warnings from the loadlibrary command? What is the output of libfunctions('xisl','-full') for these two functions? One thing you could try is to make a copy of Acq.h and change line typedef HANDLE HACQDESC to typedef unsigned int HACQDESC qxrd appears to be GPL software have you built a debug version? Can you try debugging the crash? What does the stack output look like?
From: kees de Kapper on 24 Jun 2010 09:30 "Philip Borghesani" <philip_borghesani(a)mathworks.spam> wrote in message <hvt7ev$f2o$1(a)fred.mathworks.com>... > One thing you could try is to make a copy of Acq.h and change line > typedef HANDLE HACQDESC > to > typedef unsigned int HACQDESC > Dammed Phil, YOU ARE GREAT! (I think) You solved the problem! Thank you very much for your help. Kees.
From: Philip Borghesani on 24 Jun 2010 10:08 "kees de Kapper" <kees_de_kapper(a)hotmail.com> wrote in message news:hvvmlg$o5f$1(a)fred.mathworks.com... > "Philip Borghesani" <philip_borghesani(a)mathworks.spam> wrote in message <hvt7ev$f2o$1(a)fred.mathworks.com>... > >> One thing you could try is to make a copy of Acq.h and change line >> typedef HANDLE HACQDESC >> to >> typedef unsigned int HACQDESC >> > > Dammed Phil, YOU ARE GREAT! (I think) You solved the problem! > > Thank you very much for your help. > > Kees. > Kees, I will guess the problem was this bug in R2009b: http://www.mathworks.com/support/bugreports/585124 Phil
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: seeking help on logic expression Next: Reading a large mixed CSV file of unknown types and size |