- Home /
x64 dll workaround
As most programmers nowadays only release their SDK's, API's or drivers in an x64 format I was wondering,... actually I really need to find a way to acces a x64 dll from the 32bit Unity platform. (using P-invoke)
I've been researching this problem for quite a while now, and going backwards (from 64 bit to 32 bit) doesn't seem to be a problem. But what if I want to go the other way? Is there some workaround for this problem?
P.S. Pointing out that a x64 Unity editor should be available isn't going to help, because the Unity team is getting pretty nervous about it
This is massively outside my area of expertise, but can you write some kind of 32-bit DLL that simply proxies from Unity through to your 64-bit DLL?
I would have to write CO$$anonymous$$ objects. Or a socket based interface. I think that's way too much work for the few methods I need.
What happens when you try? Bring in the RunTime Interop namespace and declare your methods you're importing to invoke. You might have to adjust IntPtr.Size
to 8 when you make your call. I'm interesting in hearing what errors (if any) you get.
A quick not about the pointer size. A pointer (which is basically a reference to a memory location) on 32-bit Windows is stored in 4 bytes i.e 4 x 8 = 32 bits. On 64-bit Windows it’s stored in 8 bytes i.e 8 x 8 = 64 bits.
DllNotFoundExceptions... But I've tried building the project in x64. I can use the x64 dll when I put it inside the same folder as the .exe that is created. It's a $$anonymous$$or annoyance that I can't use the unity debugger to test my app with the dll, but it works.
Hi. I know this is suuper old, but you mentioned it's easy to use a 32 bit dll from a 64 bit build? Can you provide any hints on this? Thanks!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
dll error when build 4 Answers
Any CPU DLL does not work in 64 bit editor 0 Answers
Using 2 DLLs with the same name 2 Answers