![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4
![]() |
GCC Linux question
Yeah...its me trobouling you lot again.
Wots wrong in this: typedef struct {
void (__stdcall * StringCallback)(char * string);
void (__stdcall * IntCallback)(int eint);
} CallbacksGalore;in gcc: g++ -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-shared --with-system-zlib --libexecdir=/usr/lib --enable-nls --without-included-gettext --enable-threads=posix --program-suffix=-4.0 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9) I mean...used to work fine in windows vc++... Thanks in advance
__________________
Spread your wings and fly! Chicken! |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 893
Rep Power: 4
![]() |
Good question, whats wrong with it?
If you are getting errors from gcc, why not put them here to save us having to guess. |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4
![]() |
so gcc is not meant to support function pointers?
__________________
Spread your wings and fly! Chicken! |
|
|
|
|
|
#4 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#5 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
__stdcall is a compiler specific extension (specific to vc++ and a couple of other compilers that target windows, anyway) not supported by gcc.
|
|
|
|
|
|
#6 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4
![]() |
But its supposed to work on linux!!! http://www.programmersheaven.com/2/Calling-conventions
__________________
Spread your wings and fly! Chicken! |
|
|
|
|
|
#7 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
Even if you accept that link as definitive (which I don't), it describes calling conventions supported by compilers, not the means of tickling a compiler to use them.
In any event, there is no point in bleating if a compiler complains when you try to use something like __stdcall. __stdcall is openly a compiler specific extension. In this Microsoft did the right thing: names with one or more leading underscores fall into a set reserved by the C and C++ standards for compiler specific extensions. There is no requirement for other compilers to support such extensions. Your solution is to remove the __stdcall qualifier. If you want to be sensitive to compilers (or, more accurately, libraries that insist on using extensions like __stdcall) that require you to use __stdcall, then use macros to help. #if defined(WHATEVER_MACRO_IDENTIFIES_YOUR_COMPILER)
#define STDCALL __stdcall
#elif defined (__GNUG__) /* gcc IIRC */
#define STDCALL
#endif
typedef struct {
void (STDCALL * StringCallback)(char * string);
void (STDCALL * IntCallback)(int eint);
} CallbacksGalore; |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|