linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: taeung <treeze.taeung@gmail.com>
To: linux-perf-users@vger.kernel.org
Subject: About use of dlsym()
Date: Fri, 08 Aug 2014 15:29:26 +0900	[thread overview]
Message-ID: <53E46E46.5000700@gmail.com> (raw)

Hello, perf hackers :-)

I'm beginner in perf.
I'm analysing the sequence of function call and how it was written to 
update 'report' of gtk view.

This is a thread of a command 'perf report --gtk'

1. run_argv()
(in main of perf.c:534)

2. handle_internal_command()
(in run_argv of perf.c:420 )
So far, I've thought this process is to filter what command and option is

3. cmd_report()
(in run_builtin of perf.c:319) by function pointer

4. setup_browser()
(in cmd_report of builtin-report.c:750)

5. setup_gtk_browser()
(in setup_browser of ui/setup.c:74)

6. perf_gtk__init()
(in setup_gtk_browser of ui/setup.c:32)

about number 6, I have a question.

In setup_gtk_browser of ui/setup.c: 28 ~ 32,

  28         perf_ui_init = dlsym(perf_gtk_handle, "perf_gtk__init");
  29         if (perf_ui_init == NULL)
  30                 goto out_close;
  31
  32         if (perf_ui_init() == 0)
  33                 return 0;
  34

Why not call directly 'perf_gtk__init()' ?
Why call the function by function pointer(perf_ui_init) after it is 
gotten by 'dlsym()' ?
Why use 'dlsym()' ?
Is it better than calling directly the function ?

- Taeung -

             reply	other threads:[~2014-08-08  6:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-08  6:29 taeung [this message]
2014-08-09 13:39 ` About use of dlsym() Taeung
2014-08-11  7:25 ` Namhyung Kim
2014-08-12  5:51   ` taeung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53E46E46.5000700@gmail.com \
    --to=treeze.taeung@gmail.com \
    --cc=linux-perf-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).