c++ - Why do we use "__declspec(dllimport)" when it seems so useless? -


this question has answer here:

some 1 told me if want export library need use __declspec(dllexport), , when uses library or needs add __declspec(dllimport). today found not necessary.

for reason need __declspec(dllimport)?

from documentation:

using __declspec(dllimport) optional on function declarations, compiler produces more efficient code if use keyword. however, must use __declspec(dllimport) importing executable access dll's public data symbols , objects. note users of dll still need link import library.


Comments