Connecting Tech Pros Worldwide Forums | Help | Site Map

Porting to a new compiler, that doesn't support virtual functions...

corner76@gmail.com
Guest
 
Posts: n/a
#1: Oct 10 '05
Hi all,

I have designed, implemented and tested this code, and it runs
perfectly. Now we're porting it to ARM11, and its compiler doesn't
support virtual function in compination with something that's inherent
in our application and cannot be changed.
So I have to figure out how to implement virtuality myself.

I have a base class (representing a prameter) with some derived classes
(one per paramter type). I have a container of the base class objects,
that uses virtual functions to "work" with the objects.

I tried just using a void * array with one entry per virtual function.
The population is an issue because of type converstions. Then invoking
the methods is impossible without casting to the real type. Well - I'm
in a mess.

Help, anyone?

Thanks!

Keren.


Geo
Guest
 
Posts: n/a
#2: Oct 10 '05

re: Porting to a new compiler, that doesn't support virtual functions...


corner76@gmail.com wrote:[color=blue]
> Hi all,
>
> I have designed, implemented and tested this code, and it runs[/color]

What code ?
[color=blue]
> perfectly. Now we're porting it to ARM11, and its compiler doesn't
> support virtual function in compination with something that's inherent
> in our application and cannot be changed.[/color]

What 'something' ?

If it doesn't support virtual functions, then it's not a C++ compiler.
[color=blue]
> So I have to figure out how to implement virtuality myself.
>
> I have a base class (representing a prameter) with some derived classes
> (one per paramter type). I have a container of the base class objects,
> that uses virtual functions to "work" with the objects.
>
> I tried just using a void * array with one entry per virtual function.
> The population is an issue because of type converstions. Then invoking
> the methods is impossible without casting to the real type. Well - I'm
> in a mess.
>
> Help, anyone?[/color]

Get a compiler that compiles C++ code
[color=blue]
>
> Thanks!
>
> Keren.[/color]

makc.the.great@gmail.com
Guest
 
Posts: n/a
#3: Oct 10 '05

re: Porting to a new compiler, that doesn't support virtual functions...


Geo wrote:[color=blue]
> Get a compiler that compiles C++ code[/color]

while this is very true,
in C scenario you might try global funcs which accept void *my_this or
something like that.

Jay Nabonne
Guest
 
Posts: n/a
#4: Oct 10 '05

re: Porting to a new compiler, that doesn't support virtual functions...


On Mon, 10 Oct 2005 04:43:28 -0700, corner76 wrote:
[color=blue]
> Hi all,
>[/color]

<snip>
[color=blue]
>
> I tried just using a void * array with one entry per virtual function.
> The population is an issue because of type converstions. Then invoking
> the methods is impossible without casting to the real type. Well - I'm
> in a mess.
>[/color]

Don't use void pointers. Use real pointer-to-member-functions, each
having the correct signature. Then initialize the pointers in the
individual constructors to point to the right member functions.

- Jay

Closed Thread