Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning C4091: ' __declspec(dllexport)'

Tags:

declspec

I have the following code where I am trying to export a function called "Interface_API" out of my dll.

#ifdef INTERFACEDLL_EXPORTS
#define UserApp_API __declspec(dllexport);
#else
#define UserApp_API __declspec(dllimport);
#endif

UserApp_API int Interface_API(int *, int *, int *);

When I compile this code it gives the following warning and the function is not getting exported.

warning C4091: ' __declspec(dllexport)' : ignored on left of 'int' when no variable is declared

When I change the declaration as given below I don't get the warning and it exports properly.

__declspec(dllexport) int Interface_API(int *, int *, int *);

I am little confused because I have used it in different dll and it works fine. Any clue?

like image 373
Ela Avatar asked Oct 24 '25 11:10

Ela


1 Answers

#define UserApp_API __declspec(dllimport);
                                         ^ Semicolon.
like image 143
Quentin Avatar answered Oct 27 '25 02:10

Quentin