Ok, it was definately the 64-bit issue and I've found a "solution" of sorts. First up,
this post clued me onto the possible solution, and then
this blog entry has some further thoughts on a similar issue.
The basic problem is that everything in the framework gets run as 64-bit, which is normally not a big deal, but becomes a problem when calling into native libraries as the wrapper is doing. Then it has to match up with either 32-bit or 64-bit. The simple fix is to go to C:\Windows\Microsoft.NET\Framework64\v2.0.50727 and call
- Code: Select all
ldr64 setwow
to force the system into always using 32-bit .NET. To clear the flag and go back to 64-bit, you call
- Code: Select all
ldr64 set64
.
After I set my machine into 32-bit mode, the Cobra compiler worked perfectly and my program ran. Unfortunately the binary file won't run once the flag is reset, even if it was built in 32-bit mode. So my program will be stuck as 64-bit incompatible until I can track down a final solution to the problem (which may be as useless as "find 64-bit native libraries"), but at least I can build and work on it again.
Thanks for helping me track down the exception in MSDN, I feel kind of lazy for not having thought to do that myself. I hope the solution I found helps anyone else who might have this issue.
EDIT:
On-going discoveries: I tried rebuilding the wrapper library to target x86 platforms in VS to force the application into 32-bit mode. Turns out this setting was already on, so I tried "Any CPU" instead. With that option, Cobra can successful build the library into the application, but then the app itself crashes with this error:
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
Parameter name: obj
at Cobra.Lang.CobraImp.GetPropertyValue(Object obj, String propertyName)
at Game.Dispose()
at Program.Main()
at MainWrapper.Main()
The relevant bit of code is:
- Code: Select all
var scon
var con as RootConsole?
def run
.con = RootConsole.getInstance
.scon = RootConsole.getNewConsole(46, 20)
def dispose
.con.dispose
.scon.dispose
So trading one problem for another. Don't think just changing the platform is going to do the trick here.