PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > extra feature on function syntax, what is it for?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
extra feature on function syntax, what is it for?

Réponse
 
LinkBack Outils de la discussion
Vieux 16/01/2008, 22h33   #1
michael.goossens@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut extra feature on function syntax, what is it for?

I'm a beginning c++ user, pretty handy at java already but I want to
transfer to c++. Particullary because c++ is way better in processing
graphical processes and mathematical calculations fast. So I was
looking at some code of a graphic tool and stumbled on this:

COREDLL void pbrtCleanup() {
StatsCleanup();
// API Cleanup
if (currentApiState == STATE_UNINITIALIZED)
Error("pbrtCleanup() called without pbrtInit().");
else if (currentApiState == STATE_WORLD_BLOCK)
Error("pbrtCleanup() called while inside world block.");
currentApiState = STATE_UNINITIALIZED;
delete renderOptions;
renderOptions = NULL;
}

Which is a function and I always thought it was <output type>
fct_name(<input types) by syntax. But now there is an extra feature in
front of the output type, the COREDLL thing in this case. Can someone
explain this to me?

Also on top of the page there is something defined like:
COREDLL ParamSet NullParams;

I'm not sure if I saw it before a class definition too or not but if
so I would like to know about it too .

Thanks alot already

ps: you can see the code where I got this from at http://prideout.net/pbrt/api.cpp
  Réponse avec citation
Vieux 16/01/2008, 22h46   #2
Jack Klein
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: extra feature on function syntax, what is it for?

On Wed, 16 Jan 2008 14:33:03 -0800 (PST), "michael.goossens@gmail.com"
<michael.goossens@gmail.com> wrote in comp.lang.c++:

> I'm a beginning c++ user, pretty handy at java already but I want to
> transfer to c++. Particullary because c++ is way better in processing
> graphical processes and mathematical calculations fast. So I was
> looking at some code of a graphic tool and stumbled on this:
>
> COREDLL void pbrtCleanup() {
> StatsCleanup();
> // API Cleanup
> if (currentApiState == STATE_UNINITIALIZED)
> Error("pbrtCleanup() called without pbrtInit().");
> else if (currentApiState == STATE_WORLD_BLOCK)
> Error("pbrtCleanup() called while inside world block.");
> currentApiState = STATE_UNINITIALIZED;
> delete renderOptions;
> renderOptions = NULL;
> }
>
> Which is a function and I always thought it was <output type>
> fct_name(<input types) by syntax. But now there is an extra feature in
> front of the output type, the COREDLL thing in this case. Can someone
> explain this to me?


Well, not in detail, because it is not something defined by C++.

"COREDLL" is either one of two things:

1. Some sort of non-standard, compiler/platform specific macro that
tells the compiler to do something out of the ordinary, such as use a
particular calling or parameter passing interface.

2. Even more likely, a macro that expands to something equivalent to
number 1.

A quick Google for "COREDLL" turns up links that seem to indicate that
is an extension used particularly for Windows CE, and not.

For more information:

http://www.google.com/search?hl=en&q...=Google+Search

> Also on top of the page there is something defined like:
> COREDLL ParamSet NullParams;
>
> I'm not sure if I saw it before a class definition too or not but if
> so I would like to know about it too .
>
> Thanks alot already


If you don't program for Windows CE, or even better, never heard of
Windows CE, you cannot use this code, at least as it is written.

If you do program for Windows CE, and want more information, try
Microsoft's MSDN web site or Windows CE specific newsgroups. It is a
Windows thing, not a C++ one.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
  Réponse avec citation
Vieux 17/01/2008, 00h28   #3
Tomás Ó hÉilidhe
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: extra feature on function syntax, what is it for?

michael.goossens@gmail.com:

> COREDLL void pbrtCleanup()



You'll probably find that COREDLL is a #define for something like
"__stdcall". So what you have would be:

__stdcall void pbrtCleanup()

The C++ Standard doesn't have any mention of anything like "__stdcall", but
on your own particular platform it might mean something like "this function
is to be provided as an exported function in the DLL file".

--
Tomás Ó hÉilidhe
  Réponse avec citation
Vieux 17/01/2008, 11h06   #4
michael.goossens@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: extra feature on function syntax, what is it for?

yeah you are right, I got this information too . thanks!

COREDLL is a macro defined in pbrt.h. The reason is that on windows
systems you need __declspec() commands to import/export class
definitions to/from dll's (I forget which). For unix systems the
COREDLL token will be removed by the preprocessor.

#ifdef WIN32

#ifdef CORE_SOURCE
#define COREDLL __declspec(dllexport)
#else
#define COREDLL __declspec(dllimport)
#endif
#define DLLEXPORT __declspec(dllexport)

#else

#define COREDLL
#define DLLEXPORT

#endif
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 12h39.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11613 seconds with 12 queries