linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: leslie.polzer@gmx.net
To: linux-c-programming@vger.kernel.org
Cc: leslie.polzer@gmx.net
Subject: Problem with pointer to external function
Date: Fri, 1 Jul 2005 12:30:26 +0200	[thread overview]
Message-ID: <20050701103026.GA2965@paktahn.black.cat> (raw)

[-- Attachment #1: Type: text/plain, Size: 1244 bytes --]

Hello list,

why do it get the segfault below? What's wrong?


[sky@paktahn ~/code/cbtest]% cat main.c      
#include <stdio.h>

typedef void (*callback)();

extern callback cb;

int
main (int argc, char** argv)
{
        cb();

        return(0);
}

[sky@paktahn ~/code/cbtest]% cat defhandlers.c       
void cb()
{
}

[sky@paktahn ~/code/cbtest]% gcc main.c defhandlers.c -ggdb
[sky@paktahn ~/code/cbtest]% gdb ./a.out 
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /home/sky/code/cbtest/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x5de58955 in ?? ()
(gdb) bt full
#0  0x5de58955 in ?? ()
No symbol table info available.
#1  0x08048367 in main (argc=1, argv=0xbffff634) at main.c:10
No locals.
(gdb)


Regards,

Leslie

-- 
PGP-KID: 0x52D70289

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2005-07-01 10:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-01 10:30 leslie.polzer [this message]
2005-07-01 10:54 ` Problem with pointer to external function Rechberger Markus
2005-07-01 11:17 ` Steve Graegert
2005-07-01 16:41 ` Glynn Clements

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=20050701103026.GA2965@paktahn.black.cat \
    --to=leslie.polzer@gmx.net \
    --cc=linux-c-programming@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).