Sponsored Content
Full Discussion: Function Returning Pointer
Top Forums Programming Function Returning Pointer Post 302507017 by majid.merkava on Tuesday 22nd of March 2011 02:23:10 PM
Old 03-22-2011
but when when returning from a function, all memory returned to OS isn't it?
 

10 More Discussions You Might Find Interesting

1. Programming

Problem with function which reutrns pointer to a value

i have a function: char *pcCityIdToCountryName(ADMIN_DB_DATA *pstHEader, unit uiCityID) this returns a pointer to CountryName if cityId is given. to retrieve countryname i give: char *CountryName; CountryName = pcCityIdToCountryName(..................); but when i compile it is giving :... (5 Replies)
Discussion started by: jazz
5 Replies

2. Programming

string returning function

I have two string returning function in ESQL/C char *segment_name(lbuffer) char *lbuffer; {..... and char *get_bpdvalue(f_name) char *f_name; {...... both declared above main() char *get_bpdvalue(); char *segment_name(); my problem is segment_name works on sprintf and strcpy... (5 Replies)
Discussion started by: jisc
5 Replies

3. Programming

How to return void function pointer

Hello all im trying to build function that will return void function pointer what is mean is ( not working ) the main function void * myClass::getFunction(int type){ if(type==1) return &myClass::Test1; if(type==2) return &myClass::Test2; } void myClass::Test1(){... (1 Reply)
Discussion started by: umen
1 Replies

4. Shell Programming and Scripting

returning from a function

Hi all, I am very new to BASH shell programming. I need to return an integer from a function to the caller function. I did this: but it keeps giving me wrong return: Can someone help me out here, please? Thanks (2 Replies)
Discussion started by: alirezan
2 Replies

5. Shell Programming and Scripting

Returning the name of function used

Hi All In my script, I can call on several functions. I have a logging function that is called by any of these functions. What I would like is some way of identifying which function I am using and pass this to the log function as some parameter. Is there some built in command or way of... (3 Replies)
Discussion started by: kingpin2502
3 Replies

6. Programming

Function pointer to inline function ?

Hi. Problem: I have to parse the payload of a packet. The payload could be in Big Endian Format (network byte order) or little. That depends on a flag present in the header of the packet. Solution: A horrible solution could be to check for that flag everytime I have to read a field in the... (11 Replies)
Discussion started by: emitrax
11 Replies

7. Programming

structure pointer array as function parameters

if i create an array of pointers to a structure "struct node" as: struct node *r; and create "n" number of "linked lists" and assign it to the various struct pointers r using some function with a return type as structure pointer as: r=multiplty(.......) /*some parameters*/ is... (2 Replies)
Discussion started by: mscoder
2 Replies

8. Programming

Trivial doubt about C function pointer

Hi, In the below C code, #include <stdio.h> void print() { printf("Hello\n"); } int main() { void (*f)() = (void (*)()) print; f(); (*f)(); } I wonder, how the syntaxes "f()" and "(*f)()" are treated as same without any error? Is this an improvement or ANSI/ISO... (1 Reply)
Discussion started by: royalibrahim
1 Replies

9. Programming

Pure C function pointer on printing vowels twice

Have difficulty to understand this pure C code to only print vowels twice from input string. Questions are commented at the end of each place. #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <limits.h> /* *Demonstrate the use of dispatch tables */ /*Print a char... (11 Replies)
Discussion started by: yifangt
11 Replies

10. Programming

Segmentation fault when I pass a char pointer to a function in C.

I am passing a char* to the function "reverse" and when I execute it with gdb I get: Program received signal SIGSEGV, Segmentation fault. 0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72 72 *q = *p; Attached is the source code. I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 Replies
DWARF_GET_VARS(3)					   BSD Library Functions Manual 					 DWARF_GET_VARS(3)

NAME
dwarf_get_vars, dwarf_var_cu_offset, dwarf_var_die_offset, dwarf_var_name_offsets, dwarf_varname -- retrieve information about static vari- ables LIBRARY
DWARF Access Library (libdwarf, -ldwarf) SYNOPSIS
#include <libdwarf.h> int dwarf_get_vars(Dwarf_Debug dbg, Dwarf_Var **vars, Dwarf_Signed *nvars, Dwarf_Error *err); int dwarf_var_cu_offset(Dwarf_Var var, Dwarf_Off *cu_offset, Dwarf_Error *err); int dwarf_var_die_offset(Dwarf_Var var, Dwarf_Off *die_offset, Dwarf_Error *err); int dwarf_var_name_offsets(Dwarf_Var var, char **name, Dwarf_Off *die_offset, Dwarf_Off *cu_die_offset, Dwarf_Error *err); int dwarf_varname(Dwarf_Var var, char **name, Dwarf_Error *err); DESCRIPTION
These functions retrieve information about the file scope static variables associated with a DWARF debug context. Information about these static variables is returned using opaque descriptors of type Dwarf_Var. Applications need to use the functions described below to retrieve the name and offset information contained in these descriptors. Function dwarf_get_vars() retrieves descriptors for all the static variables associated with the DWARF debug context specified by argument dbg. The argument vars should point to a location that will be set to a pointer to an array of Dwarf_Var descriptors. The argument nvars should point to a location that will be set to the number of descriptors returned. Function dwarf_var_cu_offset() returns the section-relative offset, relative to the ``.debug_info'' section, of the compilation unit that contains the debugging information entry associated with the argument var. Argument cu_offset should point to a location that will hold the returned offset. Function dwarf_var_die_offset() retrieves the section-relative offset, relative to the ``.debug_info'' section, of the debugging information entry associated with the argument var, and stores it into the location pointed to by the argument die_offset. Function dwarf_var_name_offsets() retrieves both the name and the associated offsets for the debugging information entry for argument var. Argument name should point to a location which will be set to a pointer to a NUL-terminated string containing the name of the associated debugging information entry. Argument die_offset should point to a location which will be set to a section-relative offset, relative to the ``.debug_info'' section, of the associated debugging information entry. Argument cu_die_offset should point to a location which will be set to a section-relative offset, relative to the ``.debug_info'' section, of the first debugging information entry in the compilation unit asso- ciated with argument var. Function dwarf_varname() sets the location pointed to by argument name to a pointer to a NUL-terminated string holding the name of the debug- ging information entry associated with the argument var. Memory Management The memory area used for the array of Dwarf_Var descriptors returned in argument vars by function dwarf_get_vars() is owned by the DWARF Access Library (libdwarf, -ldwarf). Application code should not attempt to directly free this pointer. Portable code should instead use the function dwarf_vars_dealloc(3) to indicate that the memory area may be freed. The memory area used for the string returned in the name argument to functions dwarf_var_name_offsets() and dwarf_varname() is owned by the DWARF Access Library (libdwarf, -ldwarf). Portable code should indicate that the memory area can be freed using the dwarf_dealloc(3) func- tion. Error Returns If argument err is not NULL, these functions will use it to store error information, in case of an error. RETURN VALUES
On success, these functions returns DW_DLV_OK. In case of an error, they return DW_DLV_ERROR and set the argument err. ERRORS
These functions may fail with the following errors: [DW_DLE_ARGUMENT] One of the arguments cu_die_offset, cu_offset, dbg, die_offset, var, vars, name, or nvars was NULL. SEE ALSO
dwarf(3), dwarf_dealloc(3), dwarf_get_cu_die_offset_given_cu_header_offset(3), dwarf_vars_dealloc(3) BSD
April 2, 2011 BSD
All times are GMT -4. The time now is 05:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy