As far as I know, we need __declspec(dllexport)
to export symbols to import libraries (.lib files), which are required by implicit linking.
When I glanced at d3d11.h, I found that all functions don't have __declspec
.
But how to explain the existing import library d3d11.lib? Could implicit linking works without __declspec(dllimport)
in headers when we try to call functions in them.
Could implicit linking works without __declspec(dllimport)
in headers when we try to call functions in them?
This applies to Win .dlls (when working with VStudio).
There are 2 stages:
There are multiple ways (3) to export symbols from a .dll. Check:
Might also want to read:
[SO]: How to build a DLL version of libjpeg 9b? (@CristiFati's answer) (especially Export data from the .dll section)
This is typically when building a client for the (above) .dll (could be an app or another .dll).
According to [MS.Learn]: Import into an application using __declspec(dllimport) (emphasis is mine):
Using __declspec(dllimport)
is optional on function declarations, but the compiler produces more efficient code if you use this keyword.