c# - DllImport Based on OS Platform -


I have a mix of unmanaged code (backend) and managed code (front end), like I need to call the interop Unmanaged code from my managed code using techniques and DllImport attribute

Now, I have compiled two versions of unmanaged code for both 32 and 64 bit OSes; They are named as service32.dll and service64.dll respectively. Therefore, in my net code, I will have to do DllImport for both delays: 32 bit for

And call on what basis my app is running.

The issue is now that for each unmanaged function I have to declare it twice, this is a duplication of work for a 32 bit OS and a 64 bit OS, and all the time I have an unmanaged function Changing the signature, I have modified it in two places.

Anyway, can I change the argument in the DllImport so that the correct DLL on the basis of the platform is automatically applied?

I do not think that supports DllImport, you just manually call LoadLibrary etc. You can.

But take a look, the answer will be similar to yours.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -