Nice - this will also fail with the same error:

function BLOBLEN(Value: PBlob): Integer; cdecl;
begin
   Result := 1;
end;

I admit I find this very mystifying.

Josef

> Hi!
>
> What could possibly be wrong with the following UDF?
>
> * Function *
>
> type
>     TBlob = {packed} record
>       GetSegment: TISC_BlobGetSegment;
>       BlobHandle: PInt;
>       SegmentCount: LongInt;
>       MaxSegmentLength: LongInt;
>       TotalSize: LongInt;
>       PutSegment: TISC_BlobPutSegment;
>     end;
>     PBlob = ^TBlob;
>
> function BLOBLEN(Value: PBlob): Integer; cdecl;
> begin
>     if Value = nil then
>       Result := 0
>     else
>       Result := Value^.TotalSize;
> end;
>
> * Declaration *
>
> DECLARE EXTERNAL FUNCTION BLOBLEN
> BLOB
> RETURNS INTEGER
> ENTRY_POINT 'BLOBLEN' MODULE_NAME 'pwIBUDF';
>
> * Usage *
>
> SELECT BLOBLEN(someblobfield) FROM sometable
>
> I expect to get a list of lengths of a particular BLOB field in the
> table. In reality, I get an error on Firebird 1.5, 2.1 and 2.5. Error
> log of FB 2.5 says:
>
>       The user defined function:      BLOBLEN
>          referencing entrypoint:      BLOBLEN
>                       in module:      pwIBUDF
>       caused the fatal exception: Access violation.
>               The code attempted to access a virtual
>               address without privilege to do so.
>       This exception will cause the Firebird server
>       to terminate abnormally.
>
> Which seems rather strange, considering that Firebird was supposed to
> pass me a valid BLOB descriptor - and in fact, in a similar function
> (but one which returns BLOB contents as a string) apparently does.
>
> I'd welcome any pointers (no pun intended).
>
> Thanks,
>
> Josef
>
>
> ------------------------------------
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu.  Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Yahoo! Groups Links
>
>
>



------------------------------------

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://www.firebirdsql.org and click the Resources item
on the main (top) menu.  Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/firebird-support/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/firebird-support/join
    (Yahoo! ID required)

<*> To change settings via email:
    firebird-support-dig...@yahoogroups.com 
    firebird-support-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    firebird-support-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to