Main Page | Report this Page
.NET DotNet Forum Index  »  .NET Framework Forum  »  32-bit to 64-bit application...
Page 1 of 1    

32-bit to 64-bit application...

Author Message
John Whitworth...
Posted: Tue Oct 13, 2009 2:02 am
Guest
I'm still having major issues getting my application to work on both
32-bit and 64-bit Windows. It is a smart card application, using
Winscard. I am having to use different function declarations to call
the Winscard DLL on 32-bit from what I use on 64-bit. I.e. on 32-bit,
it only works if I use Int32 in some fields, whereas on 64-bit, it
only works if I use Int64 on those same fields.

This may be a stupid question, but am I getting these problems because
my compile is targetting Any CPU? Would I be safer just targetting x86
to run on both 32-bit and 64-bit Windows? Or should that not be an
issue?

Thanks

John
 
John Whitworth...
Posted: Tue Oct 13, 2009 3:41 am
Guest
On 13 Oct, 14:00, Armin Zingler <az.nos... at (no spam) freenet.de> wrote:
Quote:
John Whitworth schrieb:

I'm still having major issues getting my application to work on both
32-bit and 64-bit Windows. It is a smart card application, using
Winscard. I am having to use different function declarations to call
the Winscard DLL on 32-bit from what I use on 64-bit. I.e. on 32-bit,
it only works if I use Int32 in some fields, whereas on 64-bit, it
only works if I use Int64 on those same fields.

IntPtr?

This may be a stupid question, but am I getting these problems because
my compile is targetting Any CPU? Would I be safer just targetting x86
to run on both 32-bit and 64-bit Windows? Or should that not be an
issue?

If you don't use components that are 32-bit components, I'd always compile
for Any CPU. (AFAIK the MS Jet is a 32-bit-only component) "Any CPU" will
give you the correct IntPtr size on the executing platfrom. You must
check all your declarations and change to IntPtr where it has to be changed.
For example, handles (like window handles) have to be declared as Intptr.
If your "Winscard DLL" is a 32-bit-only component, you must compile for x86.

--
Armin

Thanks Armin. I will investigate IntPtr. Winscard is part of the
Platform SDK.

John
 
Armin Zingler...
Posted: Tue Oct 13, 2009 7:00 am
Guest
John Whitworth schrieb:
Quote:
I'm still having major issues getting my application to work on both
32-bit and 64-bit Windows. It is a smart card application, using
Winscard. I am having to use different function declarations to call
the Winscard DLL on 32-bit from what I use on 64-bit. I.e. on 32-bit,
it only works if I use Int32 in some fields, whereas on 64-bit, it
only works if I use Int64 on those same fields.

IntPtr?

Quote:
This may be a stupid question, but am I getting these problems because
my compile is targetting Any CPU? Would I be safer just targetting x86
to run on both 32-bit and 64-bit Windows? Or should that not be an
issue?

If you don't use components that are 32-bit components, I'd always compile
for Any CPU. (AFAIK the MS Jet is a 32-bit-only component) "Any CPU" will
give you the correct IntPtr size on the executing platfrom. You must
check all your declarations and change to IntPtr where it has to be changed.
For example, handles (like window handles) have to be declared as Intptr.
If your "Winscard DLL" is a 32-bit-only component, you must compile for x86.

--
Armin
 
Armin Zingler...
Posted: Tue Oct 13, 2009 8:00 am
Guest
John Whitworth schrieb:
Quote:
On 13 Oct, 14:00, Armin Zingler <az.nos... at (no spam) freenet.de> wrote:
John Whitworth schrieb:

I'm still having major issues getting my application to work on both
32-bit and 64-bit Windows. It is a smart card application, using
Winscard. I am having to use different function declarations to call
the Winscard DLL on 32-bit from what I use on 64-bit. I.e. on 32-bit,
it only works if I use Int32 in some fields, whereas on 64-bit, it
only works if I use Int64 on those same fields.
IntPtr?

This may be a stupid question, but am I getting these problems because
my compile is targetting Any CPU? Would I be safer just targetting x86
to run on both 32-bit and 64-bit Windows? Or should that not be an
issue?
If you don't use components that are 32-bit components, I'd always compile
for Any CPU. (AFAIK the MS Jet is a 32-bit-only component) "Any CPU" will
give you the correct IntPtr size on the executing platfrom. You must
check all your declarations and change to IntPtr where it has to be changed.
For example, handles (like window handles) have to be declared as Intptr.
If your "Winscard DLL" is a 32-bit-only component, you must compile for x86.

--
Armin

Thanks Armin. I will investigate IntPtr. Winscard is part of the
Platform SDK.

Oh, I see now. For example, the SCardLocateCards function's first parameter
is of type SCARDCONTEXT which is a ULONG_PTR which again is an "unsigned long"
or an __int64, so IntPtr (or UIntPtr; it doesn't really matter) is the
correct type.

--
Armin
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Fri Dec 04, 2009 1:13 pm