extra feature on function syntax, what is it for?



 DEVELOP > c-Plus-Plus > extra feature on function syntax, what is it for?

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: ""
Date: 16 Jan 2008 04:33:03 PM
Object: 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
.

User: "Jack Klein"

Title: Re: extra feature on function syntax, what is it for? 16 Jan 2008 04:46:42 PM
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=COREDLL&btnG=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
.

User: "=?iso-8859-1?q?Tom=E1s_=D3_h=C9ilidhe?="

Title: Re: extra feature on function syntax, what is it for? 16 Jan 2008 06:28:53 PM
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
.
User: ""

Title: Re: extra feature on function syntax, what is it for? 17 Jan 2008 05:06:53 AM
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
.



  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER