Welcome, Guest. Please login or register.

Author Topic: Amiga 3.9 Includes in C++  (Read 2580 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline SteadyTopic starter

Amiga 3.9 Includes in C++
« on: July 21, 2004, 01:21:14 PM »
Hi all.

I have what may be a really dopey question.

The 3.9 includes are riddled with 'void *' types which C++ doesn't like at all.

I was wondering what the best way around this is in GCC 2.95.x.

Is there a switch to ignore the problem, a different version of the include files (perhaps with replacement ULONGs) or something else?

This has stopped me using C++ in favour of C in the past and I probably don't have to. May as well sort it out now.

Any help would be appreciated.
 

Offline SteadyTopic starter

Re: Amiga 3.9 Includes in C++
« Reply #1 on: July 21, 2004, 04:40:44 PM »
Thanks for the reply Karlos.

It is problems like the AllocVec() one you mention above that return APTR as defined in the includes. APTR is defined as void * and usually these are typecast to what I actually want. I will have another look tonight and see if I can get clued up and have a working example.

Actually, I just noticed this in the exec/types.h v40:

#ifndef APTR_TYPEDEF
#define APTR_TYPEDEF
typedef void          *APTR;       /* 32-bit untyped pointer */
#endif

Can I assume that I can fix my problem by putting the following before exec/types.h is included?:

typedef unsigned long *APTR;
 

Offline SteadyTopic starter

Re: Amiga 3.9 Includes in C++
« Reply #2 on: July 22, 2004, 09:14:47 AM »
Beauty. That's what I was looking for... couldn't see the forest for the trees. Sometimes it's easy to miss the obvious when you come across something slightly different.

Thanks for the help.