Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
806 views
in Technique[技术] by (71.8m points)

c# - Unable to find an entry point named 'InterlockedIncrement' in DLL 'kernel32.dll' - VS2005@Win7 64 bit

I have a problem with my Visual Studio 2005 C# project. I have been using it under Windows XP, since Monday. Then my laptop broke down and on my new one I have Windows 7 64 bit and I am still using VS 2005.

There is no problem with compilation of the source, but when I run the program it breaks on the line below

OdbcConnection cn;
cn = new OdbcConnection("dsn=My_dsn_name;");

I get the error:

EnrtyPointNotFoundExcepition was unhalted

Unable to find an entry point named 'InterlockedIncrement' in DLL 'kernel32.dll'

I am trying to connect with a Postgres 8.4 database using PostgresODBC 64 bit driver.

Any solution or workaround is welcome. I need to stress that the solution I am building needs to run under Windows XP 32bit.

Updated information about the issue (from my respones to the comments but not only):

  1. When I tried to add new connection to my VS project I got the message ERROR [IM014] [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application. I use Windows 7 64 bit, Postgres ODBC 64 bit Driver ver. 9.00.0200, Postgres 8.4 32 bit.
  2. I have never used Dependency Walker before. But I have opened kernel32.dll from both system32 and SysWOW64 and InterlockedIncrement is present in files from both folders.
  3. I have some TableAdapters, and I use them to fetch data from the Postgres. It was set when I was using WinXP, and it still works. On the other hand, when in VS2005 in the properties of TableAdapter I click on "..." next to Data->CommandText it displays a message Failed to call the ODBC driver connection utility.

EDIT: I added points 1-3 above.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

On 64 bit windows these are not real functions exported from kernel32.dll - they are compiler intrinsics instead. The code that is P/Invoking that function should be using the Interlocked managed class instead.

They are intrinsics on 32-bit windows too nowadays, but the exported functions are still available from kernel32.dll on 32-bit windows for app compat reasons. Not a problem for 64 bit because there were no apps to be compatible with.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...