Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

c++ syntax question

Name: Anonymous 2012-02-20 2:14

Hi /prog
When working with some other C++ libraries, I often see a class declaration like so:

class LIBRARYNAME_API ClassName
{};

Could someone please explain what the "LIBRARYNAME_API" part actually does?

Name: Anonymous 2012-02-20 5:55

>>1

When I've seen this used, it was a macro that expands to something that tells the linker to treat the symbol in some special way, like including the symbol and allowing it to be accessed from outside the library, or not including the symbol, making it accessibly only to other functions defined within the library. This is what happens when a language fails to provide a better way to manage such things, either as a built in future, or with a sufficiently powerful macro system.

Name: Anonymous 2012-02-20 6:59

Probably a macro that expands to __declspec(dllexport)/__attribute__ ((dllexport)) or __declspec(dllimport)/__attribute__ ((dllimport)) or nothing depending on build options (if building a dynamic, if linking to a dynamic lib, or building a static lib)

Name: Anonymous 2012-02-20 8:15

>>2
C++ sucks. Your english sucks. You suck. Man, I tell you, this is the kind of shit that makes me want to stop working as a computer programmer, and instead, work as a gay tranny prostitute in the castro.

Name: Anonymous 2012-02-20 8:31

>>1
>>2
>>3
>>4
Learning D will solve all your problems!

Name: Anonymous 2012-02-20 8:33

>>5
I'd rather take my chances wearing cheap control top pantyhose than program in D.

Name: Anonymous 2012-02-20 9:23

>>4
Sorry, but I like to arbitrarily concatenate phrases in my sentences. If.you(do.not(like).it()).then(maybe().you(should.write(code).that(looks.like(this)))).more(often);

Name: Anonymous 2012-02-20 9:25

>>6
why not do both?

Don't change these.
Name: Email:
Entire Thread Thread List