2

I am using Xamarin binding project and objective sharpie, to bind an objective-c library from this SDK:

http://redpark.com/lightning-ethernet-plus-power-adapter-cable-l4-netp/

I have already had success in binding and using the similar Seriel SDK. But when I try binding the ethernet SDK I get:

"The type or namespace name 'sockaddr' could not be found. Are you missing a using directory or an assembly reference?"

sockaddr is defined in sys/socket.h

The same goes for following structs: 'fd_set' defined in _fd_def.h and 'timeval' defined in _timeval.h

How do I get it to recognize these structs? Has anybody had success binding the Redpark Ethernet SDK?

My binding project is available here: https://github.com/advcv/redpark.blastclient.binding

adv
  • 21
  • 4
  • 1
    I haven't touched Xamarin's iOS or Android stuff (so there might be something special happening there), but normally C# doesn't touch native headers like that. You'd have to redefine the structs in C# with the help of `StructLayoutAttribute` and optionally `MarshalAsAttribute`. Both structs would have to be aligned the same way and be the same size for everything to work perfectly – Robert Rouhani Sep 05 '16 at 22:20
  • 1
    If you have to pass sockaddr as parameter or get it as a result in your ApiDefinition, you have to go to the socket.h and write similar C# structure and put it in the binding project as well. For sockaddr PInvoke.net site might be useful http://www.pinvoke.net/default.aspx/Structures/SOCKADDR.html – Alex Sorokoletov Oct 05 '16 at 18:22

0 Answers0