user defined routine in C 
Author Message
 user defined routine in C

Hi all,
has anyone tried to write a UDR in C that stays in a shared object.
I have build a small function in C (bandeq), compiled the module and
build a small library. Then I have
registered the function within the database using "create function..."
If I try to use the function, I get the error message:
"User defined routine (bandeq) module load failed"
Online.log contains the following message:

The C Language Module </usr/lib/libkovep.so.1.0.0> can't load reason:
Cannot find base symbol in Library

What does this mean. The library itself is correct. And this error looks
like the library was found
but the function within the library wasn't found.

I have searched the web but I have not found a step by step instruction
to build a user defined function in C using IDS.2000 and linux.
Any help is higly appreciated!



Sat, 12 Jun 2004 19:53:19 GMT
 user defined routine in C

Quote:
> Andre,

> That's because loader unable to find ABSOLUTE symbol "_etext" in your

                          ~~~~~
Must be "dynamic linker".
Quote:
> UDR, so it can't resolve references  properly.
----- Original Message -----


Sent: Tuesday, December 25, 2001 2:53 PM
Subject: user defined routine in C

> Hi all,
> has anyone tried to write a UDR in C that stays in a shared object.
> I have build a small function in C (bandeq), compiled the module and
> build a small library. Then I have
> registered the function within the database using "create function..."
> If I try to use the function, I get the error message:
> "User defined routine (bandeq) module load failed"
> Online.log contains the following message:

> The C Language Module </usr/lib/libkovep.so.1.0.0> can't load reason:
> Cannot find base symbol in Library

> What does this mean. The library itself is correct. And this error looks
> like the library was found
> but the function within the library wasn't found.

> I have searched the web but I have not found a step by step instruction
> to build a user defined function in C using IDS.2000 and linux.
> Any help is higly appreciated!



Sat, 12 Jun 2004 22:08:58 GMT
 user defined routine in C

Andre,

That's because loader unable to find ABSOLUTE symbol "_etext" in your
UDR, so it can't resolve references  properly.

The code below will  define "_etext" as ABSOLUTE symbol.

Just include this code in your code and be delighted.

Happy programming.

Sergey.
-----------------------------------------------------------------
#ifdef __linux__
static char* dummy() {
  extern char* _etext;
  return _etext;

Quote:
}

#endif //__linux__
Quote:
----- Original Message -----


Sent: Tuesday, December 25, 2001 2:53 PM
Subject: user defined routine in C

> Hi all,
> has anyone tried to write a UDR in C that stays in a shared object.
> I have build a small function in C (bandeq), compiled the module and
> build a small library. Then I have
> registered the function within the database using "create function..."
> If I try to use the function, I get the error message:
> "User defined routine (bandeq) module load failed"
> Online.log contains the following message:

> The C Language Module </usr/lib/libkovep.so.1.0.0> can't load reason:
> Cannot find base symbol in Library

> What does this mean. The library itself is correct. And this error looks
> like the library was found
> but the function within the library wasn't found.

> I have searched the web but I have not found a step by step instruction
> to build a user defined function in C using IDS.2000 and linux.
> Any help is higly appreciated!



Sat, 12 Jun 2004 22:06:31 GMT
 user defined routine in C
Sergey has correctly identified the problem. Read my "Getting Java UDRs
to work on IIF 9.21.UC4 (Linux)" posted on 12/24. It has information on
this C issue also (related to the C examples included with IIF).

I will also quote from an Informix technical source regarding this
problem/issue:

<Quote>
RedHat 7 as you know seems to have a FEW compiler issues.  However, I

loaded kgcc-1.1.2-40 and get similar, if not the same

results.

14:14:32  The C Language Module </opt/testing/ewashal/cntr.so> can't load
    reason: Cannot find base symbol in library.

This is a different problem to the compiler issue and due to a different
version
of ld, not gcc. To determine the symbol start address we look for the symbol
_etext
in the shared object. I upgraded by version of ld to: GNU ld version 2.10.90

(with BFD 2.10.0.18) and saw this problem, it does include _etext unless you
tell it to.

Either of the following two workarounds seem to be OK:

ld -shared -u _etext file.o -o file.so

Or create a file called etext.link containing the following:

SECTIONS { .text : { *(.text) _etext = .; } }

And add this file to the link line

ld -shared etext.link file.o -o file.so

I think the second version is more correct as it assigns the address to
the place where we expect it should be, I'm not certain what address gets
used in the first version - you might get incorrect stack traces.

This is easy to do in a global manner if you use DBDK Makefiles as you
only have to change the PORT_LDFLAGS in
$INFORMIXDIR/incl/dbdk/makeinc.linux.

<Quote>

Quote:

> Hi all,
> has anyone tried to write a UDR in C that stays in a shared object.
> I have build a small function in C (bandeq), compiled the module and
> build a small library. Then I have
> registered the function within the database using "create function..."
> If I try to use the function, I get the error message:
> "User defined routine (bandeq) module load failed"
> Online.log contains the following message:

> The C Language Module </usr/lib/libkovep.so.1.0.0> can't load reason:
> Cannot find base symbol in Library

> What does this mean. The library itself is correct. And this error looks
> like the library was found
> but the function within the library wasn't found.

> I have searched the web but I have not found a step by step instruction
> to build a user defined function in C using IDS.2000 and linux.
> Any help is higly appreciated!



Sun, 13 Jun 2004 22:07:24 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. User Defined Routine error

2. call a user defined function from another user-defined function

3. user defined settings (aka user defined guc variables)

4. User-defined error when the user doesn't define any errors

5. DAO in VB5 yields User-defined type not defined

6. How to define a user-defined type in ACCESS

7. Help!!-NEWBIE - Application Wizard -(WROX BOOK) Error- User defined type not defined

8. User defined type not defined

9. User defined type not defined????????

10. User-defined type not defined

11. "Database - user defined type not defined"????

12. Error: User-defined type not defined


 
Powered by phpBB® Forum Software