linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Problem with pointer to external function
@ 2005-07-01 10:30 leslie.polzer
  2005-07-01 10:54 ` Rechberger Markus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: leslie.polzer @ 2005-07-01 10:30 UTC (permalink / raw)
  To: linux-c-programming; +Cc: leslie.polzer

[-- 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 --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-07-01 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-01 10:30 Problem with pointer to external function leslie.polzer
2005-07-01 10:54 ` Rechberger Markus
2005-07-01 11:17 ` Steve Graegert
2005-07-01 16:41 ` Glynn Clements

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).