There are several possible ways discussed in detail here:
There are more LibraryLink examples here:
Once you are familiar with LibraryLink, you might want to take a look at my package, LTemplate, which makes it much quicker to build complex LibraryLink applications:
http://mathematica.stackexchange.com/questions/96127/how-to-simplify-writing-librarylink-code