Обсуждение: Use of inv_getsize in functions

Поиск
Список
Период
Сортировка

Use of inv_getsize in functions

От
"Soeren Laursen"
Дата:
Hi,

I am programming a new set of functions for manipulation blobs, one
of the functions is that I want to get the size of the blob.

The function is coded in C and goes like this:

Datum
blob_size(PG_FUNCTION_ARGS)
{ Oid blob_oid = PG_GETARG_OID(0); uint32 blobsize = 0; blobsize = inv_getsize( blob_oid ); PG_RETURN_UINT32( blobsize
);
}

I have used other function calls like
inv_open with no problem, but when I load this modules I get:

undefined symbol: inv_getsize

No errors when compiling.

I use:
postgresql 7.4.7 on debian/woody i386

Best regards,

Søren




Re: Use of inv_getsize in functions

От
Michael Fuhr
Дата:
On Tue, Aug 09, 2005 at 10:54:49PM +0200, Soeren Laursen wrote:
> I have used other function calls like
> inv_open with no problem, but when I load this modules I get:
> 
> undefined symbol: inv_getsize

Notice the word "static" in the definition of inv_getsize() in
src/backend/storage/large_object/inv_api.c:

static uint32
inv_getsize(LargeObjectDesc *obj_desc)
{   ...
}

I don't know if there's a good reason for inv_getsize() being static.
Maybe your code could use inv_seek() instead.

> No errors when compiling.

If you compile with warning flags, then you should at least have
gotten a warning like "implicit declaration of function `inv_getsize'".
That's a hint that something's wrong.

-- 
Michael Fuhr


Re: Use of inv_getsize in functions

От
Alvaro Herrera
Дата:
On Tue, Aug 09, 2005 at 10:54:49PM +0200, Soeren Laursen wrote:
> Hi,
> 
> I am programming a new set of functions for manipulation blobs, one
> of the functions is that I want to get the size of the blob.

Huh, we don't call them "blobs".  They are "large objects" in
PostgreSQL.

> I have used other function calls like
> inv_open with no problem, but when I load this modules I get:
> 
> undefined symbol: inv_getsize

That's because inv_getsize is declared as static.

I think it would be nice to export equivalent functionality, so one can
get the size of the LO without having to seek() and tell().

-- 
Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
"¿Que diferencia tiene para los muertos, los huérfanos, y aquellos que han
perdido su hogar, si la loca destrucción ha sido realizada bajo el nombre
del totalitarismo o del santo nombre de la libertad y la democracia?" (Gandhi)


Re: Use of inv_getsize in functions

От
"Soeren Laursen"
Дата:
Hi,

Red ears, looking down on my shoes!

Well I code one getsize my self using inv_seek.

Had disabled a lot of compiler warnings because I am reusing a lot of
spaghetti code for testing etc. This was proberly a hint for starting
to clean up the code.

Regards,

Søren

> On Tue, Aug 09, 2005 at 10:54:49PM +0200, Soeren Laursen wrote:
> > I have used other function calls like
> > inv_open with no problem, but when I load this modules I get:
> >
> > undefined symbol: inv_getsize
>
> Notice the word "static" in the definition of inv_getsize() in
> src/backend/storage/large_object/inv_api.c:
>
> static uint32
> inv_getsize(LargeObjectDesc *obj_desc)
> {
>     ...
> }
>
> I don't know if there's a good reason for inv_getsize() being static.
> Maybe your code could use inv_seek() instead.
>
> > No errors when compiling.
>
> If you compile with warning flags, then you should at least have
> gotten a warning like "implicit declaration of function `inv_getsize'".
> That's a hint that something's wrong.
>
> --
> Michael Fuhr
>