Archived

This topic is now archived and is closed to further replies.

mingw, dlls, templates

This topic is 5020 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I''m just porting a piece of code, and trying to get it to compile with mingw. Here is the code: template DLL_EXPORT class SegmentedCurve<2, ControlPoint<2> >; and DLL_EXPORT is defined as __declspec(dllexport) and the error is: parse error before `;'' token and when DLL_EXPORT is defined as nothing, it will compile fine. Is there some kind of switch im missing for compiling dll''s with mingw or is this some other problem? Thanks.

Share this post


Link to post
Share on other sites
In MinGW __declspec() is a function style macro definition, which boils down to: #define __declspec(x) __attribute__((x)).

In MSVC __declspec(dllexport) is a storage class modifier, which means it modifies the type. In gcc __attribute__((dllexport)) is a type attribute and so it instead becomes part of the actual type definition. So when applying __declspec(dllexport) in MinGW, the __declspec(dllexport) should go after the class keyword.

Share this post


Link to post
Share on other sites