LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices



Old

Example: sig-handler funcs for C and C++ (throw-catch) PART 2

Posted 05-14-2012 at 12:37 AM by rainbowsally
Updated 05-14-2012 at 08:39 AM by rainbowsally (possible cpu hang if -O2 switch is used)

UPDATE:
Note: The signal-handler files can't be compiled with the -O2 switch and it's probably best if you only trap the signals you really intend to redirect, such as SIGSEGV (11). If you compile what we have here with the -O2 switch your cpu may hang if you try to exit using Ctrl-C for example. See implementation notes added to signal-handler.c below.

See part 1 for main functions to test this in C and C++.

To throw and catch stuff like segfaults in C++ it's...
Member
Posted in Uncategorized
Views 1150 Comments 0 rainbowsally is offline
Old

Example: sig-handler funcs for C and C++ (throw-catch) PART 1

Posted 05-14-2012 at 12:22 AM by rainbowsally

Today's Features
  • THROW-CATCH in C
  • Translating signals to C++ throw-catch parameters.

To compile the C++ example these vars are set in mc2.def and should be similar for other methods of building it.
Code:
COMPILE = g++ -m32 -c -o # COMPILE <output_file> ...
CFLAGS = -Wall -g3 --save-temps
# or CFLAGS = -Wall -O2 # optimized
INCLUDE = -I $(SRCDIR) -I$(PREFIX)/include 

LINK = g++ -m32 -o # LINK <output_file> ...
LDFLAGS = #
...
Member
Posted in Uncategorized
Views 1129 Comments 0 rainbowsally is offline

  



All times are GMT -5. The time now is 12:35 AM.

Main Menu
Advertisement

Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration