From: Jared M. <eag...@ee...> - 2005-11-11 19:09:59
|
I'm fairly new to swig, so I'm sorry if this question is answered in the documentation. It's quite a large learning curve. I'm using SWIG to wrap C++ in to C#. I'm having a problem with numerous functions that take regular data types as arguments. This function, for example: C++ bool injectKeyDown(uint key_code); When it's wrapped, this is the resulting code: [DllImport("CeguiBindings", EntryPoint="CSharp_GuiSystem_InjectKeyDown")] public static extern bool GuiSystem_InjectKeyDown(HandleRef jarg1, HandleRef jarg2); The first argument, as I understand it, is the necessary HandleRef for keeping the GC from cleaning stuff up. The second argument SHOULD be that UINT, but for some reason it's using another HandleRef. I don't have this problem when using custom data types. Here's an example of a function that is working: C++ bool injectMouseButtonUp(MouseButton button); "MouseButton" is an enum (right, left, etc.) The wrapped code for this one is like this: [DllImport("CeguiBindings", EntryPoint="CSharp_GuiSystem_InjectMouseButtonUp")] public static extern bool GuiSystem_InjectMouseButtonUp(HandleRef jarg1, int jarg2); As you can see, the first argument is a HandleRef. no problem. The SECOND argument is the value of the enum, and is being passed in as an INT. Why is SWIG not doing this for the first example? Do I need to write some sort of custom .i code for these functions to cause swig to take that uint value properly? Jared Mark Lead Developer: Vermund ( http://vermund.eeisi.com ) League Administrator: The Ladders Gaming League ( http://www.the-ladders.com/ ) |