Reputation:
I don't know why but I thought I could statically link a function from an Import Library. It would seem I am the only one who has ever tried because I can't for the life of me find a similar post. Is there a way to selectively static link functions from a dynamically linked project without creating a new project and/or recompiling it as static? The module itself communicates over an interface and I'm not really big on exporting functions. I just want to static link the code to create the object....
how bad would it be to turn this into a macro?
IClassFactory* CF = NULL;
hr = CoGetClassObject (
CLSID_CF,
CLSCTX_INPROC_SERVER,
NULL,
IID_IClassFactory,
(void**)&CF );
Interface* Instance = NULL;
hr = CF->CreateInstance (
NULL,
IID_Interface,
(void**)&Instance );
Upvotes: 2
Views: 248
Reputation: 76541
If this is your own project (or you have source code and are willing to modify it), you could use inline
functions for the functions you don't want to dynamically link.
Upvotes: 0
Reputation: 3881
Static linking and import libraries dont go together. An import library is used for helping the linker figure out that the functions you call are in a DLL.
If you want static linking (assuming you have the code available) then reconfigure-recompile the DLL project to a static library.
Upvotes: 1