[IronPython] How would you use IronPython with WMI?

Jim Hugunin jim at ironpython.com
Wed Sep 1 04:59:43 CEST 2004

Keith J. Farmer wrote:
> I had switched to debug mode, trying to look into a bug.
> Couldn't compile -- SystemUtils was missing.
> I think I committed a sin when I added a reference to vjslib (the J#
> library) and replaced the call to SystemUtil.IdentityHashCode(o) in Ops.Id
> with a call to java.lang.System.identityHashCode(o).
> It compiled and ran, at least.
> I'm guess that it's equivalent?  Java's the only place I saw on google
> that had such a method name.

I have no idea what that Java function does.  You should use the
SystemUtils.dll that comes with IronPython.  I forgot to include this in the
debug directory, but you can simply copy the one that comes from the release
dir to debug and everything should just work.

If you feel a great need to rebuild from scratch, look at the
UtilLibraryBuilder single class project that is used to generate this simple

SystemUtils.dll contains a single function that makes a non-virtual call to
Object.GetHashCode().  This will always call the default implementation of
this method ignoring any overrides.  I use this as the closest fast
approximation to Python's notion of a unique int id for each object.  This
approach should be reconsidered from two ends.  One, the method called here
isn't guaranteed to produce a unique int for each unique object.  Two, when
you think about other developers coming to this project having this special
dll complicates the build process and it would be nice to simplify things.
It's on my list to try to figure out a better approach to getting a unique


More information about the Ironpython-users mailing list