Load a shared-object file
When you compile a C UDR, you store its object code in a shared-object file.
When the routine manager reaches the first occurrence of the UDR in the SQL statement, the routine manager determines whether its shared-object file is currently loaded into the memory space of the appropriate VP class. If the file is not yet loaded, the routine manager dynamically loads its code and data sections into the data segment for all virtual processors of the VP class. The routine manager obtains the pathname of the shared-object file from the externalname column of the row in the sysprocedures system catalog for the UDR. This loading occurs for both explicit UDR calls and implicit calls (such as operator functions and opaque-type support functions).
In the preceding figure, assume that the func1(), func2() and func3() functions are registered as user-defined functions with the CREATE FUNCTION statement and linked into the source1.so UNIX or Linux shared-object file. The client application calls the func1() user-defined function within a SELECT statement. The routine manager loads the source1.so file into memory, if this file is not yet loaded. For subsequent references to these UDRs, the routine manager can skip the shared-object load.
- When it successfully loads the shared-object file
- When it is not able to load the shared-object file for any of
the following reasons:
- The routine manager cannot find the shared-object file.
- The shared-object file does not have read permission.
- One of the symbols in the shared-object file cannot be resolved.
- When it unloads a shared-object file
12:28:45 Loading Module </usr/udrs/source1.so>
12:28:45 The C Language Module </usr/udrs/source1.so> loaded
Check the message log file for these messages to ensure that the correct shared-object file is loaded into the virtual processors.
You can monitor the loaded shared-object files with the -g dll option of onstat. This option lists the shared-object files that are currently loaded into the database server.
For information about when the shared-object file is unloaded, see Unload a shared-object file. For information about how to create a shared-object file, see Creating a shared-object file. For general information about loading a shared-object file, see the HCL Informix® User-Defined Routines and Data Types Developer's Guide.