Reputation: 1
Is there a way to insert a library name into a DLLImport statement at run time based on program parameters.
Upvotes: 0
Views: 67
Reputation: 34240
No, but it sounds like you want to do a dynamic PInvoke, which is possible.
See the technique using Marshal.GetDelegateForFunctionPointer described here: Dynamic PInvoke in Junfeng Zhang's Windows Programming Notes.
Upvotes: 4