|Title:||building sqlite on 64 bit system for 32 bit target only fails|
|Last Modified:||2011-09-16 22:15:06|
|Version Found In:||18.104.22.168|
i'm developing on a 64 bit system. if i set the configuration for all the projects to build as x86 i get the linker error:
LNK1302: only support linking safe .netmodules; unable to link pure .netmodule
i need to build the sqlite dll to be built for 32 bit systems only
shane added on 2011-06-08 12:51:37 UTC:
* Using Fossil, get a clean copy of the source.
Additional build notes here: http://system.data.sqlite.org/index.html/doc/trunk/www/build.wiki
anonymous added on 2011-09-16 19:29:22 UTC:
When you try to run AnyCPU managed application with Win32 interop on a x64 machine, .net starts application as x64 (as AnyCPU supposed to), and then fails to load x86 interop (again, by design, x64 app cannot load x86 library).
So unless there is some clever way to select correct interop (x64 or x86) at startup, AnyCPU is practically useless in this scanario.
And building Release with all projects set x86 produces described error.
mistachkin added on 2011-09-16 19:59:08 UTC:
AnyCPU is a synonym for x86. If you want to run the built files on x64, please use the x64 platform.
anonymous added on 2011-09-16 20:41:50 UTC:
When starting AnyCPU compiled .net application on x86 machine it starts as x86 process.
And on x64 machine it starts as x64 process.
So when you use AnyCPU app with x86 native dll on x64 machine it won't work.
And recompiling System.Data.SQLite.Module as x86 won't work also, 'cause it won't compile as 'safe' .netmodule if it is platform-specific.
Solution is to compile System.Data.SQLite.Module as AnyCPU, Interop as Win32, and *your app* as x86. So when your app starts as x86 process it will load SQlite assembly as x86 too.