Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.51 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Using SWIG with methods that take std::string as a parameter
  2. public void setName(SWIGTYPE_p_std__string name)
  3. {
  4.     examplePINVOKE.Shape_setName(swigCPtr, SWIGTYPE_p_std__string.getCPtr(name));
  5.     if (examplePINVOKE.SWIGPendingException.Pending) throw examplePINVOKE.SWIGPendingException.Retrieve();
  6. }
  7.        
  8. /* File : example.i */
  9. %module example
  10.  
  11. %{
  12. #include "example.h"
  13. %}
  14.  
  15. /* Let's just grab the original header file here */
  16. %include "example.h"
  17.        
  18. void Shape::setName(const std::string& name)
  19. {
  20.     mName = name;
  21. }