[sane-devel] sane_get_parameters error

David Linker dtlinker at comcast.net
Tue Mar 20 17:11:56 CET 2007


Strange. I thought that it would allocate the memory at the pointer.

In any case, I have tried allocating memory (64 bytes), and then  
passing the pointer to the memory, and that also fails, with the  
pointer  reset to NULL.

Any  ideas or suggestions for further testing welcome.

David

On Mar 20, 2007, at 6:34 AM, m. allan noah wrote:

> i dont speak this language, but you dont seem to initialize P to
> anything? you must pass in a pointer to the malloced struct, not a
> null pointer. the function does not malloc it for you. in fact, it
> cant, because there is no way to return the memory address with only a
> pointer. you would need a pointer to a pointer...
>
> allan
>
> On 3/20/07, David Linker <dtlinker at comcast.net> wrote:
>> Sorry. This is written in RealBasic, and I thought that most were not
>> familiar with it. Here is a code fragment:
>>
>>   Soft Declare Function sane_init Lib "libsane.dylib" (ByRef
>> version_code As UInt32, _
>>   auth As UInt32) As UInt32
>>   Soft Declare Function sane_get_devices  Lib "libsane.dylib" (ByRef
>> device_list As Ptr, _
>>    local_only As UInt32) As UInt32
>>   Soft Declare Function sane_open Lib "libsane.dylib" ( name As
>> CString,ByRef hand As Ptr) As UInt32
>>   Soft Declare Function sane_start Lib "libsane.dylib" (hand As Ptr)
>> As UInt32
>>   Soft Declare Function sane_get_parameters Lib
>> "libsane.dylib" (hand As Ptr, ByRef p As Ptr) As UInt32
>>
>>   Dim thevers, theRes As UInt32
>>    Dim p as Ptr
>>   Dim Ptr1, Ptr2, Ptr3 As MemoryBlock
>>   Dim theHandle As Ptr
>>
>>
>>  theRes = sane_init(theVers,0)
>>  theRes = sane_get_devices(P, 1)
>>  Ptr1 = P
>>  Ptr2=Ptr1.Ptr(0)
>>  Ptr3=Ptr2.Ptr(0)
>>
>>  theRes=sane_open(Ptr3.CString(0),theHandle)
>>
>>  theRes = sane_start(theHandle)
>>
>>  theRes = sane_get_parameters(theHandle, P)
>>
>>  //Although theRes is 0, P is nil!
>>
>> On Mar 19, 2007, at 6:06 AM, m. allan noah wrote:
>>
>> > much easier to help if you post a bit of code...
>> >
>> > allan
>> >
>> > On 3/19/07, David Linker <dtlinker at comcast.net> wrote:
>> >> I am writing a front-end for SANE, and have run into a problem.
>> >>
>> >> When I call sane_get_parameters, the sane_parameters pointers  
>> comes
>> >> back as a nil pointer, even though the Status is 0, or no error.
>> >>
>> >> I am calling this after a successful sane_init and sane_open.
>> >>
>> >> Any ideas or suggestions?
>> >>
>> >> Thanks,
>> >>
>> >> David Linker
>> >>
>> >> --
>> >> sane-devel mailing list: sane-devel at lists.alioth.debian.org
>> >> http://lists.alioth.debian.org/mailman/listinfo/sane-devel
>> >> Unsubscribe: Send mail with subject "unsubscribe your_password"
>> >>              to sane-devel-request at lists.alioth.debian.org
>> >>
>> >
>> >
>> > --
>> > "The truth is an offense, but not a sin"
>> >
>> > --
>> > sane-devel mailing list: sane-devel at lists.alioth.debian.org
>> > http://lists.alioth.debian.org/mailman/listinfo/sane-devel
>> > Unsubscribe: Send mail with subject "unsubscribe your_password"
>> >             to sane-devel-request at lists.alioth.debian.org
>>
>>
>
>
> -- 
> "The truth is an offense, but not a sin"




More information about the sane-devel mailing list