You will have no problem if the DLL whose export you are P / Invoke is also available in 64-bit. Which definitely holds for a Windows DLL, such as kernel32.dll. GetPrivateProfileString () will work just as well, you do not need to change the [DllImport] attribute. Assuming you used IntPtr where you need it.
Odds become lower when using a third-party DLL or COM server that is outdated or not included in Windows. You'll quickly find out if you need to redefine the x86 Target platform, a run-time exception is loud enough. You will get a BadImageFormat exception for pinvoked DLLs, 32-bit COM servers throw a Not Registered class exception.
source share