Closed gedw99 closed 3 years ago
Ok i get how the archi works https://github.com/Inkeliz/gowebview/blob/master/generator/generate.go
is this a comöiled version of https://github.com/webview/webview that is embedded ?
Well, for Darwin/Linux it still needs CGO (and the .dylib/.so must be in the same folder): just as the regular webview/webview
. It's a slightly modified version of https://github.com/webview/webview. I adapt to conform to the new WebView
interface.
The generator.go
creates the lib_*.go
files (such as https://github.com/Inkeliz/gowebview/blob/master/lib_window.go). All those files (only used by Windows at webview_windows.go
) are extracted when you run the New()
function:
That makes it possible to load the DLL. The DDL is loaded after the execution, using LazyLoad
:
That is the trick to avoid CGO and to make possible to extract the DLL.
It's not possible to do that on the webview/webview
, since Golang looks for the DLL at the startup of the software, so you can't execute anything because it crashes. That was the only reason to create that new library.
That changes is only applied to Windows, others plataforms remains unchanged.
About the lib folder, it has all .dll
/.dylib
/.so
, and you can get from https://github.com/webview/webview_csharp/tree/master/libs. It's only used by go generate
to create lib_*.go
files.
In that case, copy the libwebview.dylib
and paste that file in the same folder of the executable. It may works since it's the same of webview/webview
(it uses CGO).
Android is my priority for now. Of course, it will use CGO (since it's using JNI), but it's what I need for now. I may remove the Darwin/Linux stuff altogether or change to make it work with CGO, and I don't know. For now, I'm ignoring Darwin/Linux. :\
I think forking will be the best solution. (:
I finally get the Android version to work, at least the basic stuff (loading pages, almost). However, gomobile build
nor go build
works, since it needs some Java to be glued together. However, to abstract all java stuff: I'm creating one executable that runs as gowebview build
(instead of go build
), so you get the .apk
quickly. I expect to release at the end of that week.
i know darwin is not supported. not needing CGO is a great idea.
It is probably only a matter of looking into the right system calls.
but here is the error