Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for disambiguation of NativeReference and ObjCBindingLibrary #21352

Closed
AlphaNERD- opened this issue Mar 21, 2024 · 5 comments
Closed

Comments

@AlphaNERD-
Copy link

Hello .NET MAUI devs,

like many other devs i am migrating to .NET 8. I am working with a few native SDKs for Android and iOS respectively and i ran into a few binding problems which are close to be fixed.

During my ordeal i made what turned out to be a mistake and tried to bind every SDK using ObjCBindingNativeLibrary, thus introducing a build error involving clang++. I tried to bind some SDKs using ObjCBindingNativeLibrary and others using NativeReference and while i could push the build errors aside, i could not actually use the SDK i bound using ObjCBindingNativeLibrary during runtime.

Now i've bound every SDK again using NativeReference and while i'm still dealing with build errors (duplicate symbols, a potential regression in my specific case compared to Xamarin.iOS) i would like to know the following:

What is the difference between NativeReference and ObjCBindingNativeLibrary

If i had to guess it's that ObjCBindingNativeLibrary is some internal thing. I've seen a few people use in the Github Issues but none of the devs have actively discouraged the use of it AFAIK. I do know however that NativeReference works better with the SDKs and that Microsoft asks devs to use that to reference SDKs in .NET 8.

@drasticactions
Copy link
Contributor

I think you want the SDK repo, this is for the MAUI UI project and doesn't maintain that tooling. CC @rolfbjarne

@rolfbjarne
Copy link
Member

ObjCBindingNativeLibrary is an item that was introduced quite a few years ago, and is only used for embedding libraries in binding projects.

NativeReference is a newer item, with many more capabilities, and can be used both in a binding project and an app project.

The recommendation is to never use ObjCBindingNativeLibrary, only NativeReference.

@AlphaNERD-
Copy link
Author

Could we mark ObjCBindingNativeLibrary as deprecated, obsolete or otherwise give a compiler warning then?

Funnily enough, i was binding a library using ObjCBindingNativeLibrary and i could not use the library at all. When i tried to create an object instance of the SDK, i got an exception stating that the library could not be loaded. If ObjCBindingNativeLibrary is not about to be removed then i could share a sample project showcasing the problem. I'll have to ask for permmision though from Fujitsu.

@rolfbjarne
Copy link
Member

Could we mark ObjCBindingNativeLibrary as deprecated, obsolete or otherwise give a compiler warning then?

Yes, we could issue a warning if ObjCBindingNativeLibrary is used, so I'm moving this to the xamarin/xamarin-macios repository to track this.

@rolfbjarne
Copy link
Member

This issue was moved to xamarin/xamarin-macios#20358

@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants