regarding function __declspec()

Hi,

I have downloaded some online available code from following link:

http://sourceforge.net/project/showfiles.php?group_id=214368

It does monte-carlo simulation.

If you download QHQmcmc++ and unzip the folder; then in subfolder "include", there is a file "MCMC.h" which has declaration like:

#define _EXPORTING

#ifdef _EXPORTING
#define QHQ_BAYES_DECLSPEC __declspec(dllexport)
#else
#define QHQ_BAYES_DECLSPEC __declspec(dllimport)
#endif

I could only figure out that __declspec(dllexport) has something to do with export or import in visual studio. But, I do not have any idea about why and how this import and export is done. I would really appreciate if someone over here can explain to me or guide me to relevant resources.

Second thing: If I use these functions __declspec() etc, then my code would not be compilable on other compiler. If yes, what to do about that?

Regards,
DK
It's not a function, it's an extended syntax for the purpose of generating and linking DLLs.
Why generate DLLs? IIRC, the main reasons were to save memory. A shared library only needs to be loaded once to memory, even if more than one program is using it. This also saves disk space, as the code contained in the library only needs to appear once.
How DLLs are generated? Well, basically, instead of generating code into an executable, it's generated into a file that's not runnable by itself. It's sort of like a module that a program can load and use the functions it provides.

I can't seem to find any info on the second subject.
Topic archived. No new replies allowed.