views:

138

answers:

2

Hi , I built an application in c# vs2005 .net .

Everything works fine when i run the application in win 32 bit, But when running the application in win 64 it crashes while trying to call the pinvoke interlockedexchange(which is within the kernel32.dll) function .

This is the exception : unable to find an entry point named 'interlockedexchange'

I didnt find the interlockedexchange function within the kernel32.dll under system32 directory but it was found under the syswow64 directory(in the kernel32.dll) .

I guess that the .net runtime is configured to the system32 directory and not to the syswow64 . How is it possible to change this configuration ? Can you think of any other problem that could cause this? any help would be appreciated! thanks ,

Miki Amit

A: 

This does not directly answer your question, but why not call System.Threading.Interlocked.Exhange() rather than resorting to P/Invoke?

Paul Ruane
Thanks for your reply!I need to set a Shared Memory Intptr (pointer) and far as i know the Interlocked.Exhange can change only .net variables
Miki Amit
A: 

If you are set on using InterlockedExchange and want the 32-bit version, you can change your project settings to force it to run as 32-bit. Go to the "Build" tab in the project settings and change "Platform target" to x86. It will then run as 32-bit.

Mark Wilkins