简体   繁体   中英

loading specific 32/64bit dll reference to project issue

I've been searching for a while, but appears my problem somewhat differs from the majority.

Here's the deal, I would like to make my program both 32 and 64bit compatible. Since being written in .NET it's not a problem, however I use an sqlite dll which is bit-specific.

In spite of the fact, that I have both versions of the dll, and I'm able to compile the main program for 64bit too, by re-adding the 64 bit version reference to the project, I'd like to make it work somehow differently.

Having to compile 2times is not efficient enough for me, instead, I'd like to find a way to make it dynamically adjustable: Given that the Dlls are the same, their contents:functions methods whatever, are the same, the only difference between them, is the bit version. Therefore, I would like to make my program's compatibility depend on the dll laying next to it.

Since normally it's added in the project as reference, Visual studio detects its contents by highlighting, I'd like to somehow keep it added as reference, BUT make the actual dll (which sits next to the exe) load, without losing the ability to use the dll functions the way I've done so far, in the editor, with highlightion.

I've read about Assembly.Load/LoadFrom/LoadFile, + Reflection, but it's not quite what I need.

Thank's in advance,

David

I know you have already done a lot of searching, but these two links really provide two great options for you, that you may have missed.

Import external dll based on 64bit or 32bit OS

Trying to not need two separate solutions for x86 and x64 program

In both links, look at Hans Passant answers. There's great.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM