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

Change the native library names to libSkiaSharp #77

Closed
mattleibow opened this issue May 6, 2016 · 6 comments
Closed

Change the native library names to libSkiaSharp #77

mattleibow opened this issue May 6, 2016 · 6 comments

Comments

@mattleibow
Copy link
Contributor

I have just been working with @galvesribeiro to get SkiaSharp onto a ARM v6l Linux device (yay!) #18. One of the issues was that we had to re-build SkiaSharp just so that we could change the native library name in the [DllImport].

What are the opinions of changing the native library name to a uniform libSkiaSharp so that future Linux (or any other "normal" builds) can just use the Desktop assembly?

We might even remove the need for the .dll.config file currently. (just a guess)

@galvesribeiro
Copy link

img_1789
img_1787
img_1788
img_1792

And that is working as you can see! :)

@mattleibow
Copy link
Contributor Author

Work being done in #81

mattleibow added a commit that referenced this issue May 13, 2016
Main change:
 * Changed the native library to libSkiaSharp for Windows, UWP, Android, OSX and iOS
   Issue #77 #81

Other changes
 * Updated the version number
 * Use Android level 10 or v2.3 s the library version
 * Update the docs
 * Allow for the case where a custom libSkiaSharp is to be provided
 * Make sure we have all the Android architectures
@kekekeks
Copy link
Contributor

Why not use dlsym/GetProcAddress and Marshal.GetDelegateFromFunctionPtr instead of DllImport? That will add a lot of flexibility in native library location like looking for correct CPU arch version in libSkiaSharp-x86.dll or libSkiaSharp-x64.dll depending on current platform.

Something like that (MIT-licensed):
https://github.com/kekekeks/evhttp-sharp/blob/master/EvHttpSharp/Interop/LinuxLoader.cs
https://github.com/kekekeks/evhttp-sharp/blob/master/EvHttpSharp/Interop/OsxLoader.cs
https://github.com/kekekeks/evhttp-sharp/blob/master/EvHttpSharp/Interop/Win32Loader.cs

https://github.com/kekekeks/evhttp-sharp/blob/master/EvHttpSharp/Interop/Event.cs (usage)

@kekekeks
Copy link
Contributor

The only issue that I see is iOS static linker, but I think that a custom dlsym (skiasharp_dlsym or something) could be implemented in the native code. We did it this way in our old skia-based backend in avalonia(aka perspex) and it worked quite well.

@jameswalmsley
Copy link

Are there any instruction on how this was achieved. I want to run SkiaSharp on native Linux but intel.

@mattleibow
Copy link
Contributor Author

@jameswalmsley I just use a default name of libSkiaSharp.[a/dll/so/dylib]

I do this in the https://github.com/mono/SkiaSharp/blob/v1.53.0/binding/Binding/SkiaApi.cs#L48-L62
You should be able to just #if __LINUX__ or something. But, it should also fall back to the default "libSkiaSharp" and the mono runtime will automatically select the correct extension on the platform.

@mattleibow mattleibow added this to To Be Classified in Previous Releases Jul 26, 2018
@ghost ghost locked as resolved and limited conversation to collaborators Aug 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Previous Releases
To Be Classified
Development

No branches or pull requests

4 participants