Difference between revisions of "YARP and CSHARP"

From Wiki for iCub and Friends
Jump to: navigation, search
 
Line 1: Line 1:
 +
Note: in order to have the C# bindings to work under linux you need yarp to be compiled in shared mode.
 +
 
The current supported method for using YARP from C# is via SWIG.  See:
 
The current supported method for using YARP from C# is via SWIG.  See:
 
   $YARP_ROOT/bindings
 
   $YARP_ROOT/bindings
 +
README in that directory contains information.
  
Read the README in that directory.
+
In theory you can just do:
In the end you should have a project file. Compile it, it will generate a bunch of .cs files in the /generated_src directory.
 
  
Create the directory /YarpCS
+
  cd $YARP_ROOT/bindings
Open Visual Studio and start a new Classes Library project named YarpCS in /YarpCS.
+
  mkdir buildCS
 +
  cd buildCS
 +
  ccmake ..
 +
  make
 +
 
 +
You should end with a dynamic library (yarp.dll in windows, libyarp.so in linux) move that somewhere in your path (windows) or $LD_LIBRARY_PATH (linux).
 +
 
 +
You should also have a bunch of .cs files in the /generated_src directory, they will serve to generate the .NET dll.
 +
 
 +
Create a directory /YarpCS
 +
Open Visual Studio / monodevelop and start a new Classes Library project named YarpCS in /YarpCS.
  
 
From this project, remove the "Class1.cs" generated by visual studio and add all the .cs file generated by swig earlier.
 
From this project, remove the "Class1.cs" generated by visual studio and add all the .cs file generated by swig earlier.
Line 15: Line 27:
  
 
Try to create a new project, click on add reference and add YarpCS.dll ; intellisense should give you access to Yarp.
 
Try to create a new project, click on add reference and add YarpCS.dll ; intellisense should give you access to Yarp.
 
Then to run this project you need to have the dll generated by SWIG in your path. This dll should by in /YARP_DIR/example/swig/Release and be called ''yarp.dll''
 
Either add this directory to your path, or move the dll in some place which is in your path.
 

Latest revision as of 09:28, 10 May 2013

Note: in order to have the C# bindings to work under linux you need yarp to be compiled in shared mode.

The current supported method for using YARP from C# is via SWIG. See:

 $YARP_ROOT/bindings

README in that directory contains information.

In theory you can just do:

 cd $YARP_ROOT/bindings
 mkdir buildCS
 cd buildCS
 ccmake ..
 make

You should end with a dynamic library (yarp.dll in windows, libyarp.so in linux) move that somewhere in your path (windows) or $LD_LIBRARY_PATH (linux).

You should also have a bunch of .cs files in the /generated_src directory, they will serve to generate the .NET dll.

Create a directory /YarpCS Open Visual Studio / monodevelop and start a new Classes Library project named YarpCS in /YarpCS.

From this project, remove the "Class1.cs" generated by visual studio and add all the .cs file generated by swig earlier.

Generate the solution.

It will product a file called YarpCS.dll, this is the dll that your CS project will reference.

Try to create a new project, click on add reference and add YarpCS.dll ; intellisense should give you access to Yarp.