user553625
user553625

Reputation: 1

Declaring a dll name at run time

Is there a way to insert a library name into a DLLImport statement at run time based on program parameters.

Upvotes: 0

Views: 67

Answers (1)

Rick Sladkey
Rick Sladkey

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

Related Questions