Sponsored Content
Top Forums UNIX for Dummies Questions & Answers dlsym() returns 0 for an existing function Post 302428299 by jim mcnamara on Wednesday 9th of June 2010 11:58:32 AM
Old 06-09-2010
Code:
dlsym(0, "myfunc");
/* should be */
dlsym(RTLD_SELF, "myfunc");

At least on systems I've used....

RTLD_SELF usually expands to something unusual like (void *)-3
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

dlsym...error

Hi, I have ftp.so file which on nm gives the following table.... |0x0000c4f8|0x000000f0|FUNC |LOCL |0 |14 |ftp_active |0x0000c00c|0x000000f0|FUNC |LOCL |0 |14 |ftp_ascii |0x0000c0fc|0x000000f0|FUNC |LOCL |0 |14 |ftp_binary |0x0000a8e0|0x000001a8|FUNC |LOCL... (0 Replies)
Discussion started by: Vikky Panchal
0 Replies

2. Shell Programming and Scripting

function returns string

Can I create a function to return non-interger value in shell script? for example, function getcommand () { echo "read command" read command echo $command } command=$(getcommand) I tried to do something as above. The statement echo "read command" does not show up. ... (5 Replies)
Discussion started by: lalelle
5 Replies

3. Shell Programming and Scripting

folder existing and file existing

I want to look into a folder to see if there are any folders within it. If there are, I need to check inside each folder to see if it contains a .pdf file So If /myserver/myfolder/ contains a folder AND that folder conatins a .pdf file do X Else do Z I may have multiple folders and... (4 Replies)
Discussion started by: crowman
4 Replies

4. Solaris

Add existing user into an existing group

Pre: no gpasswd/adduser there is just usermod can be used, also there is no -a option for usermod. How should I add a user into a group? (4 Replies)
Discussion started by: a2156z
4 Replies

5. Shell Programming and Scripting

insert pipes for existing and non-existing records

I have a source file like this, L4058S462 34329094 F51010141TK1070000483L4058S462 34329094 0232384840 381892 182 5690 L4058S462 34329094 F51020141FIRST CLEARING, LLC A/C 3432-9094 L4058S462 34329094 F51030141JOHAN HOLMQVIST ... (1 Reply)
Discussion started by: saravanamr
1 Replies

6. Shell Programming and Scripting

Function returns wrong values - solved

Hi I have a small function which returns a wrong value. The function tries to make a connection to oracle database and tries to get the open_mode of the database in the variable status. However when a database is down the value of the status column is set to READWRITE i am not sure why. I... (0 Replies)
Discussion started by: xiamin
0 Replies

7. Shell Programming and Scripting

Function returns a value but cannot be stored in other variable

I need help to store the value returned from the function to one variable and then use that variable. PREVIOUS_DATE_FUNCTION() { date '+%m %d %Y' | { read MONTH DAY YEAR DAY=`expr "$DAY" - 1` case "$DAY" in 0) MONTH=`expr "$MONTH" - 1` case... (1 Reply)
Discussion started by: aroragaurav.84
1 Replies

8. Shell Programming and Scripting

Help in function returns value

Hi, I need to return a value from the function. the value will be the output from cat command which uses random fucntion. #!/bin/ksh hello() { var1=$(`cat /dev/urandom| tr -dc 'a-zA-Z0-9-!%&()*+,-/:;<=>?_'|fold -w 10 | head -n 1`) echo "value is" var1 return var1 } hello var=$?... (2 Replies)
Discussion started by: Nandy
2 Replies

9. Shell Programming and Scripting

Function Returns

I'm having a little trouble returning a value from a function or calling it, I'm not quite sure. I'm calling the function here function region_lookup_with_details { results = $(set_region) echo $results } This is the function I'm calling function set_region { ... (8 Replies)
Discussion started by: akechnie
8 Replies

10. Windows & DOS: Issues & Discussions

Home Questions Tags Users Unanswered Windows 2016 DNS server returns SERVFAIL for non-existing doma

I have two DNS resolvers in /etc/resolv.conf file. The top one is Windows DNS server, and the bottom one is my wi-fi router. Please see below. nameserver 192.168.1.126 nameserver 192.168.1.1 In Windows DNS server, the sole "Forward Lookup Zone" is biman.net When I query for host in the zone... (6 Replies)
Discussion started by: broy32000
6 Replies
DLINFO(3)						   BSD Library Functions Manual 						 DLINFO(3)

NAME
dlinfo -- information about dynamically loaded object LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <link.h> #include <dlfcn.h> int dlinfo(void * restrict handle, int request, void * restrict p); DESCRIPTION
The dlinfo() function provides information about dynamically loaded object. The action taken by dlinfo() and exact meaning and type of p argument depend on value of the request argument provided by caller. The handle argument is either the value returned from the dlopen(3) function call or special handle RTLD_SELF. If handle is the value returned from dlopen(3), the information returned by the dlinfo() function pertains to the specified object. If handle is the special handle RTLD_SELF, the information returned pertains to the caller itself. Possible values for the request argument are: RTLD_DI_LINKMAP Retrieve the Link_map (struct link_map) structure pointer for the specified handle. On successful return, the p argument is filled with the pointer to the Link_map structure (Link_map **p) describing a shared object specified by the handle argument. The Link_map structures are maintained as a doubly linked list by ld.so(1), in the same order as dlopen(3) and dlclose(3) are called. See EXAMPLES, example 1. The Link_map structure is defined in <link.h> and has the following members: caddr_t l_addr; /* Base Address of library */ const char *l_name; /* Absolute Path to Library */ const void *l_ld; /* Pointer to .dynamic in memory */ struct link_map *l_next, /* linked list of mapped libs */ *l_prev; l_addr The base address of the object loaded into memory. l_name The full name of the loaded shared object. l_ld The address of the dynamic linking information segment (PT_DYNAMIC) loaded into memory. l_next The next Link_map structure on the link-map list. l_prev The previous Link_map structure on the link-map list. RTLD_DI_SERINFO Retrieve the library search paths associated with the given handle argument. The p argument should point to Dl_serinfo structure buffer (Dl_serinfo *p). The Dl_serinfo structure must be initialized first with the RTLD_DI_SERINFOSIZE request. The returned Dl_serinfo structure contains dls_cnt Dl_serpath entries. Each entry's dlp_name field points to the search path. The corresponding dlp_info field contains one of more flags indicating the origin of the path (see the LA_SER_* flags defined in the <link.h> header file). See EXAMPLES, example 2, for a usage example. RTLD_DI_SERINFOSIZE Initialize a Dl_serinfo structure for use in a RTLD_DI_SERINFO request. Both the dls_cnt and dls_size fields are returned to indi- cate the number of search paths applicable to the handle, and the total size of a Dl_serinfo buffer required to hold dls_cnt Dl_serpath entries and the associated search path strings. See EXAMPLES, example 2, for a usage example. RTLD_DI_ORIGIN Retrieve the origin of the dynamic object associated with the handle. On successful return, p argument is filled with the char pointer (char *p). RETURN VALUES
The dlinfo() function returns 0 on success, or -1 if an error occurred. Whenever an error has been detected, a message detailing it can be retrieved via a call to dlerror(3). EXAMPLES
Example 1: Using dlinfo() to retrieve Link_map structure. The following example shows how dynamic library can detect the list of shared libraries loaded after caller's one. For simplicity, error checking has been omitted. Link_map *map; dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map); while (map != NULL) { printf("%p: %s ", map->l_addr, map->l_name); map = map->l_next; } Example 2: Using dlinfo() to retrieve the library search paths. The following example shows how a dynamic object can inspect the library search paths that would be used to locate a simple filename with dlopen(3). For simplicity, error checking has been omitted. Dl_serinfo _info, *info = &_info; Dl_serpath *path; unsigned int cnt; /* determine search path count and required buffer size */ dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info); /* allocate new buffer and initialize */ info = malloc(_info.dls_size); info->dls_size = _info.dls_size; info->dls_cnt = _info.dls_cnt; /* obtain sarch path information */ dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info); path = &info->dls_serpath[0]; for (cnt = 1; cnt <= info->dls_cnt; cnt++, path++) { (void) printf("%2d: %s ", cnt, path->dls_name); } SEE ALSO
rtld(1), dladdr(3), dlopen(3), dlsym(3) HISTORY
The dlinfo() function first appeared in the Solaris operating system. In FreeBSD, it first appeared in FreeBSD 4.8. AUTHORS
The FreeBSD implementation of the dlinfo() function was originally written by Alexey Zelkin <phantom@FreeBSD.org> and later extended and improved by Alexander Kabaev <kan@FreeBSD.org>. The manual page for this function was written by Alexey Zelkin <phantom@FreeBSD.org>. BSD
February 14, 2003 BSD
All times are GMT -4. The time now is 09:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy