64 bit configuration

B

bob_jeffcoat

Hi,
I'm trying to build my application for both 32 and 64 bit Windows but
my project references a non-managed Dll that comes in 2 formats, one
for 32 and one for 64. How do I set up my solution so that I can
build for both targets easily? Is it possible?

Also, are there any problems using 'unsafe' code if I'm trying to run
on x64?

Thanks,
 
W

Willy Denoyette [MVP]

Hi,
I'm trying to build my application for both 32 and 64 bit Windows but
my project references a non-managed Dll that comes in 2 formats, one
for 32 and one for 64. How do I set up my solution so that I can
build for both targets easily? Is it possible?

Also, are there any problems using 'unsafe' code if I'm trying to run
on x64?

Thanks,



This program doesn't take advantage of 64-bit, so I would suggest you to
build a 32-bit version only, a 32-bit version will run on both 32 and 64 bit
Windows.

Willy.
 
C

christery

This program doesn't take advantage of 64-bit, so I would suggest you to
build a 32-bit version only, a 32-bit version will run on both 32 and 64 bit
Windows.

Willy.

But lagging if Im correctly informed, running MS SQL server 64 bit
version only came with 32 bit management so it was best to manage it
from anywhere but the server. Guessing it gets problems with memory
alignment just like Alpha/I64 running OpenVMS or is it emulating
32bit?

//CY
 
W

Willy Denoyette [MVP]

But lagging if Im correctly informed, running MS SQL server 64 bit
version only came with 32 bit management so it was best to manage it
from anywhere but the server. Guessing it gets problems with memory
alignment just like Alpha/I64 running OpenVMS or is it emulating
32bit?

//CY



IA-64 and Alpha are "real" 64-bit processors, that is they can only run, a
single, 64-bit based instruction set.
The X86-64 kind architectures(AMD 64 and Intel 64) have two different modes
of operation, a native mode and an extended mode.
These processors can run native 32-bit (IA-32) code when initialized in
native mode, and 64-bit code (IA-32e)when initialized for long mode, the
"64-bit" instruction set is nothing more than an extension of the IA-32
instruction set (hence the IA-32e), and is completely different from the
IA64 instruction set. The great advantage of this architecture is that it
can run 32-bit X86 and "64-bit" user code while running a 64-bit (X64) based
OS, without the need for a 32-bit "emulator" like the IA64 and Alpha
architecture does.
All the (X64) OS has to do, is perform a switch from IA-32 mode to IA-32e
mode when a 32-bit user program transitions into the kernel, this switch
takes a hit of less than 100 cycles, which is < 0.2% of the time taken to
transition into kernel space.
The alignment requirements depend on the mode the processor actually
executes, no surprises here, 32-bit code must adhere to the IA-32
requirements, while IA-32e has the 64-bit requirements.


Willy.
 
B

bob_jeffcoat

IA-64and Alpha are "real"64-bit processors, that is they can only run, a
single,64-bit based instruction set.
The X86-64kind architectures(AMD64and Intel64) have two different modes
of operation, a native mode and an extended mode.
These processors can run native 32-bit (IA-32) code when initialized in
native mode, and64-bit code (IA-32e)when initialized for long mode, the
"64-bit" instruction set is nothing more than an extension of the IA-32
instruction set (hence the IA-32e), and is completely different from the
IA64 instruction set. The great advantage of this architecture is that it
can run 32-bit X86 and "64-bit" user code while running a64-bit (X64) based
OS, without the need for a 32-bit "emulator" like the IA64 and Alpha
architecture does.
All the (X64) OS has to do, is perform a switch from IA-32 mode to IA-32e
mode when a 32-bit user program transitions into the kernel, this switch
takes a hit of less than 100 cycles, which is < 0.2% of the time taken to
transition into kernel space.
The alignment requirements depend on the mode the processor actually
executes, no surprises here, 32-bit code must adhere to the IA-32
requirements, while IA-32e has the64-bit requirements.

Willy.


Hi,
Thanks for the help.

But I want my application to be able to reference more than 3GB of
RAM, it's an FE analysis program and I could easily imagine it using
10GBs or more. I gathered that I needed to specify x64 in the
Executable project to get the extra memory. So I think I do need a 64
bit configuration but I really want the two builds to use the same
source code but I can't see how this is possible if I have seperate 32
and 64 bit references.

What do you think?


bob
 
C

christery

IA-64 and Alpha are "real" 64-bit processors, that is they can only run, a
single, 64-bit based instruction set.
The X86-64 kind architectures(AMD 64 and Intel 64) have two different modes
of operation, a native mode and an extended mode.
These processors can run native 32-bit (IA-32) code when initialized in
native mode, and 64-bit code (IA-32e)when initialized for long mode, the
"64-bit" instruction set is nothing more than an extension of the IA-32
instruction set (hence the IA-32e), and is completely different from the
IA64 instruction set. The great advantage of this architecture is that it
can run 32-bit X86 and "64-bit" user code while running a 64-bit (X64) based
OS, without the need for a 32-bit "emulator" like the IA64 and Alpha
architecture does.
All the (X64) OS has to do, is perform a switch from IA-32 mode to IA-32e
mode when a 32-bit user program transitions into the kernel, this switch
takes a hit of less than 100 cycles, which is < 0.2% of the time taken to
transition into kernel space.
The alignment requirements depend on the mode the processor actually
executes, no surprises here, 32-bit code must adhere to the IA-32
requirements,  while IA-32e has the 64-bit requirements.

Willy.

Thanks, didnt realize that... we run the sql server on a HP 4620/40/60
something... ( I guess... they dont mark them too well) I converted my
code for Aplha 1200 -> I64 on a 2620/40... something.. (pizza carton,
2U high) didnt release it though, no stable dev-env yet, has to test
it for all our other products, and I think Forms handeling of float or
something is holiding us back, or maybe IBM MQ.. or both
and the way in my thoughts was that I64 is x64, just like xNIX ->
uNIX, linux, ubuntu, redhat an so on...

So there are different strands/iterations/models of 64 bits out
there... I thought that when Intel helped HP with the processor it
would be the same... Guess not... we coult and have run WNT on a Alpha
2100 but thats over... will never go there again... Support? yeaah...
its like running OS/2 and complain about the printers/drivers doesnt
work.. been there, done that

The alingment error "started" when going to alpha, and it will get
worse going to I64, got an example of some code from the teacher (but
he trned the optimizer off) with 0,2 sek for the vax&vms/5 sec for
alpha and almost 100 sec for I64 with deliberate wrong code and
telling the compiler not to take care of it...

Just wondering if I will go OpenVMS or Windoze on our Oracle10g
installation... and the hardware platform, and wirtualizing it, and
putting disks in the SAN or .... arrrgh...

Thanks for taking time to explain it to me Willy

PS

like my uVAX II with VMS 4.5, RD53 disks/TK50 and all... gives me
hedaces just to order spare parts... but It works! (and so does the
DECSA connecting us to the mainframe)

//CY
 
W

Willy Denoyette [MVP]

Hi,
Thanks for the help.

But I want my application to be able to reference more than 3GB of
RAM, it's an FE analysis program and I could easily imagine it using
10GBs or more. I gathered that I needed to specify x64 in the
Executable project to get the extra memory. So I think I do need a 64
bit configuration but I really want the two builds to use the same
source code but I can't see how this is possible if I have seperate 32
and 64 bit references.

What do you think?


bob



You can only address much less than 2GB when running on an 32-bit OS, so you
will have to deal with the addressable memory range in your code. The
remaining is just a deployment issue, you build your application targeting
(AnyCPU) and create two deployment packages, one for X86 (including the
32-bit version of the unmanaged code DLL(s)) and another for X64 (including
the 64-bit versions of the unmanaged dll's).

Willy.
 
R

RobinS

We have a case where we have a license file that changes based on the build
configuration. So if you're compiling in Debug mode, it needs one license
file; if you're compiling in Release mode, it needs a different one.

We handled this by setting up a folder called \license_debug and a folder
called \license_release in the project, and putting the appropriate license
in each folder.

Then with post-build commands, we use the right variables and copy the right
one into the main folder. This is why our folders are called debug and
release. Here's the post-build command:

COPY/Y "$(TargetDir)license_$(ConfigurationName)\*.*" "$(TargetDir)"

Presumably, you could do the same thing with DLLs.

RobinS.
GoldMail, Inc.
 
C

christery

You can only address much less than 2GB when running on an 32-bit OS, so you
will have to deal with the addressable memory range in your code. The
remaining is just a deployment issue, you build your application targeting
(AnyCPU) and create two deployment packages, one for X86 (including the
32-bit version of the unmanaged code DLL(s)) and another for X64 (including
the 64-bit versions of the unmanaged dll's).

Willy.- Dölj citerad text -

- Visa citerad text -

But if the 32 bit address is reduced to numbers with something like
4294967295 = 4GB then where does the 2 gb limit come from... 2^32-1 or
am I loosing it... again, actually I put the minus 1 to satisfy my
"index start at zero pals"... so if I have one stone, or char or
something , then its called 0. strange... but having chair[0] is
one.. sorta Zen at first... then comes public versus static and there
we go again.. please dont respond...
 
W

Willy Denoyette [MVP]

You can only address much less than 2GB when running on an 32-bit OS, so
you
will have to deal with the addressable memory range in your code. The
remaining is just a deployment issue, you build your application targeting
(AnyCPU) and create two deployment packages, one for X86 (including the
32-bit version of the unmanaged code DLL(s)) and another for X64
(including
the 64-bit versions of the unmanaged dll's).

Willy.- Dölj citerad text -

- Visa citerad text -

But if the 32 bit address is reduced to numbers with something like
4294967295 = 4GB then where does the 2 gb limit come from... 2^32-1 or
am I loosing it... again, actually I put the minus 1 to satisfy my
"index start at zero pals"... so if I have one stone, or char or
something , then its called 0. strange... but having chair[0] is
one.. sorta Zen at first... then comes public versus static and there
we go again.. please dont respond...


The 4GB addressable memory on 32-bit must be shared with the OS, who takes
half of it (unless you have enabled 4GT RAM tuning), what's left is 2GB VAS
for user applications.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top