|
From: Steven H. <ste...@di...> - 2014-09-12 16:47:43
|
Hi, I'm new to SWIG and am trying to understand how to marshal objects between C++ and C#. Reading the SWIG 3.0 documentation I can't find any information that explains what ctype, imtype and cstype mean. They are used in the documentation on the assumption that I should know what it means. Am I missing something? All I want to be able to do is take an object and pass it to C# as an out object. So for example, if I have the method: C++: bool ParseMyObject( cont std::string& s, MyObject& obj ); C#: bool ParseMyObject( string s, out MyObject obj ); The above will work if I replace MyObject with a primitive type such as int. But if it's a class I created then it becomes SWIGTYPE_MyObject, which is not what I want. If I create a method like this: C++: MyObject GetMyObject(); C#: MyObject GetMyObject(); Then that works fine. But the ParseMyObject method still uses the SWIGTYPE_MyObject type. I have tried to understand the typemap documentation but it is unclear and hard to follow because it refers to things like imtype that I don't recognise. Can someone explain to me how to achieve the correct method signature for ParseMyObject in C#? This seems like it should be a simple and common thing to do. Is there a macro that will allow me to do it without having to write complicated typemaps? Thanks, Steven Digital Barriers e-Mail Confidentiality and Disclaimer This message contains confidential information and is intended only for the individual named. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Digital Barriers plc is a company registered in England and Wales. Registered number: 7149547. Registered office: Enterprise House, 1-2 Hatfields, London SE1 9PG, United Kingdom. For further information about Digital Barriers, please visit www.digitalbarriers.com<http://www.digitalbarriers.com/>. ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________ |