sharpie bind --output=visioAppleSdk --namespace=VisioMoveEssential --sdk=iphoneos13.2 -framework=~/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework -v
sharpie bind --output=visioAppleSdk --namespace=VisioMoveEssential --sdk=iphoneos13.2 michael/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/*.h
should run producing the api bindings to be looked over
multiple errors over each of the commands that were run, I also get a lot of clang errors when this is run.
visual studio mac 8.4.2
=== Visual Studio Community 2019 for Mac ===
Version 8.4.2 (build 59)
Installation UUID: bb4810da-c8a9-42be-9d01-e3d2c4b44a29
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.25 (issue-7441-d16-3-vsmac / 881172e73)
Package version: 606000155
=== Mono Framework MDK ===
Runtime:
Mono 6.6.0.155 (2019-08/296a9afdb24) (64-bit)
Package version: 606000155
=== Roslyn (Language Service) ===
3.4.0-beta4-19562-05+ff930dec4565e2bc424ad3bf3e22ecb20542c87d
=== NuGet ===
Version: 5.3.0.6192
=== .NET Core SDK ===
SDK: /usr/local/share/dotnet/sdk/3.1.101/Sdks
SDK Versions:
3.1.101
3.1.100
3.0.101
3.0.100
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.6.0/lib/mono/msbuild/Current/bin/Sdks
=== .NET Core Runtime ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.1.1
3.1.0
3.0.1
3.0.0
2.1.15
2.1.14
2.1.13
=== Xamarin.Profiler ===
Version: 1.6.12.29
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Apple Developer Tools ===
Xcode 11.3.1 (15715)
Build 11C504
=== Xamarin.Mac ===
Version: 6.10.0.17 (Visual Studio Community)
Hash: 5f802ef53
Branch: xcode11.3
Build date: 2020-01-07 11:53:06-0500
=== Xamarin.iOS ===
Version: 13.10.0.17 (Visual Studio Community)
Hash: 5f802ef53
Branch: xcode11.3
Build date: 2020-01-07 11:53:06-0500
=== Xamarin Designer ===
Version: 16.4.0.478
Hash: 95f0ab363
Branch: remotes/origin/d16-4
Build date: 2020-01-08 23:59:46 UTC
=== Xamarin.Android ===
Version: 10.1.3.7 (Visual Studio Community)
Commit: xamarin-android/d16-4/d66aed0
Android SDK: /Users/michael/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
7.1 (API level 25)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.5
SDK Build Tools Version: 28.0.3
Build Information:
Mono: fd9f379
Java.Interop: xamarin/java.interop/d16-4@c4e569f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.28.0@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b
=== Microsoft Mobile OpenJDK ===
Java SDK: /Users/michael/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android SDK Manager ===
Version: 16.4.0.9
Hash: 3f7256f
Branch: remotes/origin/d16-4
Build date: 2020-01-14 22:19:04 UTC
=== Android Device Manager ===
Version: 16.4.0.30
Hash: f9172e2
Branch: remotes/origin/d16-4
Build date: 2020-01-14 22:19:24 UTC
=== Xamarin Inspector ===
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 804020059
Git revision: eb6fcdd83a227678e487aa733df3c8745f54fafc
Build date: 2020-01-17 12:12:02+00
Build branch: release-8.4
Xamarin extensions: ec32c90978c94f03d72f507b01f5aee70952ce87
=== Operating System ===
Mac OS X 10.14.6
Darwin 18.7.0 Darwin Kernel Version 18.7.0
Tue Aug 20 16:57:14 PDT 2019
root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
=== Enabled user installed extensions ===
DeepClean 1.2.5
MFractor 3.10.0
NuGet Package Management Extensions 0.21
FileNesting 0.1.2
Template Creator 0.4
NuGet Package Explorer 0.4
https://github.com/mharrisonbit/BindingsTest
VisioMoveEssential-iOS-1.4.0-20170712.zip
Hello
Have you tried sharpie bind -framework VisioMoveEssential.framework? If the framework you are binding has an umbrella header (VisioMoveEssential.h) that command should do.
Let me know your results!
I get this error.
Done. Exiting with error code 1.
error: framework '~/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential' is not a directory (and neither is '~/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework')
Can you test this new experimental version of sharpie? ObjectiveSharpie-3.5.17.zip also make sure that your current working directory is /Downloads/VisioMoveEssential-iOS-1.4.0-20170712/
I will give that a try and I will also make sure that I am in that for the current working directory.
I installed the version of objective sharpie that you posted and then restarted terminal, I then ran this command "sharpie bind --output=visioAppleSdk --namespace=VisioMoveEssential --sdk=iphoneos13.2 -framework=VisioMoveEssential -v".
I ran that from "~/Downloads/VisioMoveEssential-iOS-1.4.0-20170712" directory.
That created the following error(s).
Passing the following user-specified options to Clang: -v -arch arm64 -F . -xobjective-c
Using Xcode SDK: iphoneos13.2 from Xcode 11.3.1 @ /Applications/Xcode.app
Parsing 1 header files...
System.DllNotFoundException: libc.dylib assembly:
at (wrapper managed-to-native) Clang.Driver.realpath(string,intptr)
at Clang.Driver.GetFrameworkCurrentDir (System.String dirName) [0x00038] in /Users/runner/runners/2.164.6/work/1/s/Clang/Driver.cs:177
at Clang.Driver.Run (System.String[] inputFiles, System.String[] clangArgs, Clang.Frontend.DiagnosticConsumer diagnosticConsumer) [0x000da] in /Users/runner/runners/2.164.6/work/1/s/Clang/Driver.cs:121
at Sharpie.ParseTool.Run () [0x005c8] in /Users/runner/runners/2.164.6/work/1/s/Sharpie/ParseTool.cs:581
at Sharpie.BindTool.CoreRun () [0x00001] in /Users/runner/runners/2.164.6/work/1/s/Sharpie/BindTool.cs:117
at Sharpie.BindTool.Run () [0x00026] in /Users/runner/runners/2.164.6/work/1/s/Sharpie/BindTool.cs:95
Done. Exiting with error code 1.
Hello @mharrisonbit thanks for testing this out, could you test this new experimental version? Btw doing sharpie bind -framework VisioMoveEssential.framework and ensuring your current working directory is ~/Downloads/VisioMoveEssential-iOS-1.4.0-20170712 should do the job. Please let me know how it goes!
Thank you!
I tried the new version both commands and got these errors. It worked and built the output when I used that option. but I still got the following errors. I don't know if those are due to the framework but I figure you should know what happened, good bad or indifferent.
sharpie bind -framework VisioMoveEssential.framework
I got the following errors.
Parsing 1 header files...
In file included from /private/var/folders/_t/b1t_5c455fsd1tycw9c1p6sh0000gn/T/com.xamarin.ObjectiveSharpie/37df7c06bd8f4ff790cf9f4d304c2860.h:1:
In file included from ./VisioMoveEssential.framework/Headers/VisioMoveEssential.h:48:
./VisioMoveEssential.framework/Headers/VMELocation.h:76:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) VMEPosition* position;
^
./VisioMoveEssential.framework/Headers/VMELocation.h:76:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
In file included from /private/var/folders/_t/b1t_5c455fsd1tycw9c1p6sh0000gn/T/com.xamarin.ObjectiveSharpie/37df7c06bd8f4ff790cf9f4d304c2860.h:1:
In file included from ./VisioMoveEssential.framework/Headers/VisioMoveEssential.h:53:
./VisioMoveEssential.framework/Headers/VMEMapView.h:125:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapPath;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:125:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
./VisioMoveEssential.framework/Headers/VMEMapView.h:134:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapSecretCode;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:134:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
./VisioMoveEssential.framework/Headers/VMEMapView.h:142:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapHash;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:142:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
./VisioMoveEssential.framework/Headers/VMEMapView.h:150:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapServerURL;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:150:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
Binding...
10 warnings generated.
no types were parsed that could be bound
Done. Exiting with error code 1.
sharpie bind --output=visioAppleSdk -framework VisioMoveEssential.framework
Parsing 1 header files...
In file included from /private/var/folders/_t/b1t_5c455fsd1tycw9c1p6sh0000gn/T/com.xamarin.ObjectiveSharpie/b6790f89c6ff46b29929b49fe1735ff0.h:1:
In file included from ./VisioMoveEssential.framework/Headers/VisioMoveEssential.h:48:
./VisioMoveEssential.framework/Headers/VMELocation.h:76:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) VMEPosition* position;
^
./VisioMoveEssential.framework/Headers/VMELocation.h:76:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
In file included from /private/var/folders/_t/b1t_5c455fsd1tycw9c1p6sh0000gn/T/com.xamarin.ObjectiveSharpie/b6790f89c6ff46b29929b49fe1735ff0.h:1:
In file included from ./VisioMoveEssential.framework/Headers/VisioMoveEssential.h:53:
./VisioMoveEssential.framework/Headers/VMEMapView.h:125:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapPath;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:125:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
./VisioMoveEssential.framework/Headers/VMEMapView.h:134:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapSecretCode;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:134:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
./VisioMoveEssential.framework/Headers/VMEMapView.h:142:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapHash;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:142:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
./VisioMoveEssential.framework/Headers/VMEMapView.h:150:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed
[-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapServerURL;
^
./VisioMoveEssential.framework/Headers/VMEMapView.h:150:1: warning: default property attribute 'assign' not appropriate for object
[-Wobjc-property-no-attribute]
Binding...
10 warnings generated.
no types were parsed that could be bound
Done. Exiting with error code 1.
Hello!
The output is kind of expected, what is seems to be happening is that -framework defaults would not work for this library because of the way it is built so sharpie heuristics defaults are getting in the way. Depending on how this library is integrated in Xcode those are the arguments that sharpie needs to work too since sharpie uses clang itself to create C# wrappers. The following will get you bindings of everything referenced inside VisioMoveEssential.framework/Headers #imports so your output will be a little bit verbose. That said the bindings for VisioMoveEssential will be among the output just grab what you need from the generated ApiDefinition.cs and friends files.
sharpie bind VisioMoveEssential.framework/Headers/VisioMoveEssential.h -sdk iphoneos13.2 -c -F. -fobjc-arc
Please let me know if this works for you.
So taking back my previous comment looks like something in sharpie/clang does not resolve correctly the relative paths so using sharpie bind -framework ./VisioMoveEssential.framework did work for me notice the ./, I'll try to look into what is going on but this should get you unblocked once you change the value DTSDKName to iphoneos13.2 in the framework's info.plist.
Please let me know the results and feel free to reopen if it does not work for you or have additional comments!
That seems to have worked. The api definition file is about 100 times smaller. Now I just need to figure out what I am doing from here on out. Thanks for the help I was completely lost and now I am just slightly lost. lol
I just thought I would post the output from when I tried it. Like I said I still have some issues but I don't know if its from sharpie not being able to convert the framework which I would think that can be a normal issue or if there was something else that failed. But here is the output and the code that I used to run it with. Does this seem normal or is there still issues? Again thanks for all the help that you provided to me.
sharpie bind --output=visioAppleSdk -framework ./VisioMoveEssential.framework
Parsing 1 header files...
In file included from /private/var/folders/_t/b1t_5c455fsd1tycw9c1p6sh0000gn/T/com.xamarin.ObjectiveSharpie/ea6d3029d8b6480da5fa962b45baa3c3.h:1:
In file included from /Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VisioMoveEssential.h:48:
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMELocation.h:76:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Wobjc-property-no-attribute]
@property (nonatomic) VMEPosition* position;
^
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMELocation.h:76:1: warning: default property attribute 'assign' not appropriate for object [-Wobjc-property-no-attribute]
In file included from /private/var/folders/_t/b1t_5c455fsd1tycw9c1p6sh0000gn/T/com.xamarin.ObjectiveSharpie/ea6d3029d8b6480da5fa962b45baa3c3.h:1:
In file included from /Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VisioMoveEssential.h:53:
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:125:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapPath;
^
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:125:1: warning: default property attribute 'assign' not appropriate for object [-Wobjc-property-no-attribute]
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:134:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapSecretCode;
^
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:134:1: warning: default property attribute 'assign' not appropriate for object [-Wobjc-property-no-attribute]
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:142:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapHash;
^
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:142:1: warning: default property attribute 'assign' not appropriate for object [-Wobjc-property-no-attribute]
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:150:1: warning: no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed [-Wobjc-property-no-attribute]
@property (nonatomic) IBInspectable NSString *mapServerURL;
^
/Users/michael/Downloads/VisioMoveEssential-iOS-1.4.0-20170712/VisioMoveEssential.framework/Headers/VMEMapView.h:150:1: warning: default property attribute 'assign' not appropriate for object [-Wobjc-property-no-attribute]
Binding...
[write] ApiDefinitions.cs
[write] StructsAndEnums.cs
Binding Analysis:
Automated binding is complete, but there are a few APIs which have been flagged with [Verify] attributes. While the entire binding should be audited for best API design practices, look more closely at APIs with the following Verify
attribute hints:
MethodToProperty (5 instances):
An Objective-C method was bound as a C# property due to convention such as taking no parameters and returning a value (non-void return). Often methods like these should be bound as properties to surface a nicer API, but sometimes
false-positives can occur and the binding should actually be a method.
StronglyTypedNSArray (7 instances):
A native NSArray* was bound as NSObject[]. It might be possible to more strongly type the array in the binding based on expectations set through API documentation (e.g. comments in the header file) or by examining the array
contents through testing. For example, an NSArray* containing only NSNumber* instances can be bound as NSNumber[] instead of NSObject[].
Once you have verified a Verify attribute, you should remove it from the binding source code. The presence of Verify attributes intentionally cause build failures.
For more information about the Verify attribute hints above, consult the Objective Sharpie documentation by running 'sharpie docs' or visiting the following URL:
http://xmn.io/sharpie-docs
10 warnings generated.
Done.
Oh those warnings are completely expected (and harmless), if you want to silence them you would need to let clang that is parsing arc aware headers like this
sharpie bind --output=visioAppleSdk -framework ./VisioMoveEssential.framework -c -fobjc-arc
Is that what you meant? also if you are new to bindings I would highly recommend reading this entirely in the following order
I know these are big but will give you an idea of what is going on
Hope this helps!
I am new to bindings as this is the first try at it. I was just asked if it was able to be done and I started looking into them. I was able to get an sdk for android working but I ran into issues with the iOS side. I have reached out for some help from people and I have gotten some. But, from what I have gathered this is not something that is done a lot and seems to be something somewhat specialized. Again thanks for the help and the articles I will definitely read them.
I think you should update the docs now with the new solution with ./ in https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/binding/objective-sharpie/platform/native-frameworks?context=xamarin/ios