delorie.com/djgpp/doc/libc/libc_795.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

syms_name2val

Syntax

 
#include <debug/syms.h>
extern int undefined_symbol;
extern int syms_printwhy;

unsigned long syms_name2val (const char *string);

Description

This function returns the address of a symbol specified by string. string may be one of the following:

syms_name2val looks up the specified file, line, and symbol in the symbol table prepared by syms_init, finds their addresses, adds the offset, if any, and returns the result.

If the specified file, line, or symbol cannot be found, syms_name2val returns zero and sets the global variable undefined_symbol to a non-zero value. If the global variable syms_printwhy is non-zero, an error message is printed telling which part of the argument string was invalid.

You must call syms_init (see section syms_init) before calling any of the other syms_* functions for the first time.

Return Value

The address specified by string, or zero, if none found.

Portability

ANSI/ISO C No
POSIX No

Example

 
 unsigned long addr1, addr2, addr3;

 syms_init ("foo.exe");
 addr1 = syms_name2val ("foo.c#256+12");
 addr2 = syms_name2val ("_main");
 addr3 = syms_name2val ("struct_a_var+%eax+4");


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004