Tuesday, May 22nd 2018, 6:06am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

6stringer

Beginner

Date of registration: May 19th 2015

Posts: 1

1

Wednesday, May 20th 2015, 2:52pm

Problem with virtual functions and C++

I have a program running on an atmel SAM4S processor. The program runs out of flash and was originally written in C. I've recently added a small amount of C++. I have a base class that defines a virtual function. A second class extends the base class and redefines the virtual function. The program will not run. It starts but hangs shortly after starting. If I change the code and make the virtual function not virtual (losing the desired functionality), the program runs.


I've tried a small program that has nothing in it but a base and child class with a virtual function. That small program runs with no problems.


It appears I'm having a problem with the virtual function pointer table. Any ideas on why my program crashes when using virtual functions?


Thanks,
Jim