title: Using c/c++ library that uses network for iphone app objective c
body: <p>I am currently evaluating if a c/c++ library may be used for a specific iPhone project of mine. The original library makes heavy use of windows specific code (for example it includes windows.h and winsock.h). I am aware that I will have to rewrite the parts that use windows specific code and replace winsocks with for example bsd sockets. Or try to convert to objective-c++ and use IOS specific networking apis as it's recommended in Apple's documentation.</p>
  
  <p>But as it turns out in Apple's documentation, in iOS only C and Objective-C code is allowed for networking. "iOS supports networking code written in C and Objective-C." ( <a href="https://developer.apple.com/library/ios/#referencelibrary/GettingStarted/GS_Networking_iPhone/" rel="nofollow noreferrer">https://developer.apple.com/library/ios/#referencelibrary/GettingStarted/GS_Networking_iPhone/</a> )</p>
  
  <p>That sounds like I have to rewrite the whole library in objective-c to make it work on IOS. Or would it be sufficient to programm a wrapper class in objective-c and work with the original (adapted to bsd sockets api or objective-c++) library? -> <a href="https://stackoverflow.com/questions/376966">Using C/C++ static libraries from iPhone ObjectiveC Apps</a></p>
  
  <p>But the actual networking code still would be written c/c++ not objective-c.</p>
  
  <p>Is there any chance this might work? I don't want to do all the work of adapting the library and then notice that this approach does not work.</p>
  
  <p>Has anyone tried something similiar before?</p>
  
  <p>Best regards,
  Mike</p>