Prev: MEX Fortran
Next: mcc compiler problem
From: Maurice Defo on 15 Sep 2006 06:32 Hello everyone, I NEED HELP. I'm getting crazy by trying to get access to the value of libpointer return by a dll function from library furnished by the manufacturer of USB2000 spectrometer (by Oceans OPtics Incs). Here is my program: if ~libisloaded('ooidrv32','OOIDrv32') loadlibrary('OOIDrv32'); end adcType = calllib('OOIDrv32', 'OOI_GetADCType'); setdatatype(adcType,'int16Ptr', 1, 1); get(adcType,'Value') When i debug the program, it runs very well till the last instruction where matlab crashs and says 'Error with get(adcType,'Value'): datatype and size should be defined'. The function in C is supposed to return the adcType. Here is the prototype: short OOI_GetADCType() When using libfunctions -full, here is what matlab says for that function. libpointer OOIGetADCType So the function needs no input arguments. Some functions in the library that have inputs arguments work well. That is i have easy access to the value of libpointer by the same instruction. I'm wondering if the problem for this function is that it does not require input argument. And if so, how to overcome. I NEED HELP. Thanks.
From: Philip Borghesani on 15 Sep 2006 13:10 It looks to me that something else is going wrong. libfunctions -full should return int16 for the return type for a "short" not libPointer. Use the mfilename option to loadlibrary and fix the resulting m file or look at the actual header file to make sure no other headers are needed (windows.h?) Phil that function s "Maurice Defo" <mdefo(a)utk.edu> wrote in message news:ef40d84.-1(a)webcrossing.raydaftYaTP... > Hello everyone, > > I NEED HELP. I'm getting crazy by trying to get access to the value > of libpointer return by a dll function from library furnished by the > manufacturer of USB2000 spectrometer (by Oceans OPtics Incs). > > Here is my program: > > if ~libisloaded('ooidrv32','OOIDrv32') > loadlibrary('OOIDrv32'); > end > > adcType = calllib('OOIDrv32', 'OOI_GetADCType'); > setdatatype(adcType,'int16Ptr', 1, 1); > get(adcType,'Value') > > When i debug the program, it runs very well till the last instruction > where matlab crashs and says 'Error with get(adcType,'Value'): > datatype and size should be defined'. > > The function in C is supposed to return the adcType. Here is the > prototype: > > short OOI_GetADCType() > > When using libfunctions -full, here is what matlab says for that > function. > > libpointer OOIGetADCType > > So the function needs no input arguments. Some functions in the > library that have inputs arguments work well. That is i have easy > access to the value of libpointer by the same instruction. I'm > wondering if the problem for this function is that it does not > require input argument. And if so, how to overcome. I NEED HELP. > > Thanks.
From: Maurice Defo on 15 Sep 2006 16:13 Hi Phil, Following your suggestions, I opened the header file. There is not #include window.h When I checked the signature of the function in the header file, it is like this: WORD OOI_GetADCType() I found there are some functions where the signature begins by DWORD. I generated the prototype mfilename. The LHS for OOI_GetADCType is: ..LHS = 'error' I changed the .LHS='error' to .LHS='stringPtr' The result is still libpointer and when i tried to get acces to it by get(), matlab crashed. By checking other functions where th original signature begin by DWORD, I found that the corresponding output in mfilename is of type DOUBLE. I don't know what to do. I'm trying everything. Thanks a lot for your suggestions. Another will be more than welcome. M Defo Philip Borghesani wrote: > > > It looks to me that something else is going wrong. libfunctions > -full > should return int16 for the return type for a "short" not > libPointer. Use > the mfilename option to loadlibrary and fix the resulting m file or > look at > the actual header file to make sure no other headers are needed > (windows.h?) > > Phil > > that function s > "Maurice Defo" <mdefo(a)utk.edu> wrote in message > news:ef40d84.-1(a)webcrossing.raydaftYaTP... >> Hello everyone, >> >> I NEED HELP. I'm getting crazy by trying to get access to the > value >> of libpointer return by a dll function from library furnished by > the >> manufacturer of USB2000 spectrometer (by Oceans OPtics Incs). >> >> Here is my program: >> >> if ~libisloaded('ooidrv32','OOIDrv32') >> loadlibrary('OOIDrv32'); >> end >> >> adcType = calllib('OOIDrv32', 'OOI_GetADCType'); >> setdatatype(adcType,'int16Ptr', 1, 1); >> get(adcType,'Value') >> >> When i debug the program, it runs very well till the last > instruction >> where matlab crashs and says 'Error with get(adcType,'Value'): >> datatype and size should be defined'. >> >> The function in C is supposed to return the adcType. Here is the >> prototype: >> >> short OOI_GetADCType() >> >> When using libfunctions -full, here is what matlab says for that >> function. >> >> libpointer OOIGetADCType >> >> So the function needs no input arguments. Some functions in the >> library that have inputs arguments work well. That is i have easy >> access to the value of libpointer by the same instruction. I'm >> wondering if the problem for this function is that it does not >> require input argument. And if so, how to overcome. I NEED HELP. >> >> Thanks. > > >
|
Pages: 1 Prev: MEX Fortran Next: mcc compiler problem |