Hello:

I need to link with some external native library from a managed program
written in c#.
I want my program to run in any cpu, so I need to link to the appropriate
external dll.

Is there any way to know it?

Note::
Using (IntPtr.Size == 8) I cant not know If Im in an Itanium64
processor or on an AMD 64, wich have different architectures.

Re: How to detect system architecture by Ollie

Ollie
Tue Sep 27 07:39:16 CDT 2005

you can use WMI to find out information about the system hardware
configuration, check out the following post for information about WMI
explorer

http://groups.google.com/group/microsoft.public.dotnet.general/browse_frm/thread/d5de93dc616fd1dd/02a24e4b45571e7a?lnk=st&q=WMI+explorer+ollie.riches&rnum=1&hl=en#02a24e4b45571e7a

HTH

Ollie Riches

"Daniel Bello Urizarri" <dbello[at]cadicsa.com> wrote in message
news:%23N1rXu1wFHA.3180@TK2MSFTNGP14.phx.gbl...
> Hello:
>
> I need to link with some external native library from a managed program
> written in c#.
> I want my program to run in any cpu, so I need to link to the appropriate
> external dll.
>
> Is there any way to know it?
>
> Note::
> Using (IntPtr.Size == 8) I cant not know If Im in an Itanium64
> processor or on an AMD 64, wich have different architectures.
>



Re: How to detect system architecture by Daniel

Daniel
Tue Sep 27 09:22:56 CDT 2005

About the WMI

Not sure about using it.. The solution is very dependent of the windows
platform. What about linux and Mono? I want my application run on every
platform

Is there a way inside the .net framework?
Something like the System.Environment.OSversion..?





Re: How to detect system architecture by Nick

Nick
Wed Sep 28 01:51:40 CDT 2005

You will have to release a seperate distribution for each platform anyway,
so why not just have the user who is installing your app either select a
disti for a specific architecture (which has the value coded in the config
file) or prompt the user for the architecture in your app before loading
that dll?

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Daniel Bello Urizarri" <dbello[at]cadicsa.com> wrote in message
news:%23ejp172wFHA.3740@TK2MSFTNGP14.phx.gbl...
> About the WMI
>
> Not sure about using it.. The solution is very dependent of the windows
> platform. What about linux and Mono? I want my application run on every
> platform
>
> Is there a way inside the .net framework?
> Something like the System.Environment.OSversion..?
>
>
>
>



Re: How to detect system architecture by Daniel

Daniel
Wed Sep 28 09:30:49 CDT 2005

Hi Nick:

Is not necesary to release a separate distribution. What I'm doing right
now is having a definition of the class "linked" using DllIimport to the
64bits dll version, but in runtime, if IntPtr.Size == 4, I create a similar
class using System.Reflection.Emit linked to de 32 bits version of the dll,
and use the new one.
A thing I can do is install only the external dll that will be used, but
then I shoud need to know the platform on the installer program. (win64 o
win32 for example).. so I have a similar problem.