ulCreateView doesn't exist in 1.4 dev build on arm m1 mac
a-morphous opened this issue · 4 comments
Hello! I've been playing a bit with the 1.4 dev build since I'm on an m1 mac -- forgive me for my possibly odd terminology because I'm pretty new to working with C++ shared libraries, but it looks like ulCreateView
wasn't exported to the library, or otherwise doesn't exist in the arm mac version. I noticed this issue first by building the same app on m1 mac and on windows (using 1.3 for windows), and noticing that it worked fine on windows and failed on mac with the error:
System.EntryPointNotFoundException: Unable to find an entry point named 'ulCreateView' in shared library 'Ultralight'.
at UltralightNet.Methods.<ulCreateView>g____PInvoke|81_0(Void* renderer, UInt32 width, UInt32 height, Marshaller* viewConfig, Void* session)
at UltralightNet.Methods.ulCreateView(Renderer renderer, UInt32 width, UInt32 height, ULViewConfig& viewConfig, Session session)
at UltralightNet.Renderer.CreateView(UInt32 width, UInt32 height, Nullable`1 viewConfig, Session session, Boolean dispose)
...
(This is running in C# with UltralightNet, though I'm led to believe that the issue lies with Ultralight itself, not the binding.)
I also ran nm -g
on the libUltralight.dylib
file, both for v1.3 and the v1.4 dev build, and saw that an entry for _ulCreateView
existed in the result in the 1.3 version, and not in the 1.4 version.
I'm not sure if there's anything I can do to mitigate this, or if I've set up my dependencies incorrectly. If there's any other information that would be helpful from me, please let me know!
But does the c api example work?
C# bindings do not work yet with the 1.4
It'd be better to use discord for discussing this
I have confirmed that the C API also does not work on M1 Mac with 1.4 dev, specifically for ulCreateView
.
[ 58%] Linking C executable Sample6.app/Contents/MacOS/Sample6
Undefined symbols for architecture arm64:
"_ulCreateView", referenced from:
_Init in main.c.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [samples/Sample 6 - Intro to C API/Sample6.app/Contents/MacOS/Sample6] Error 1
make[1]: *** [samples/Sample 6 - Intro to C API/CMakeFiles/Sample6.dir/all] Error 2
make: *** [all] Error 2
I did this by replacing the SDK in the built samples folder with the 1.4 version, and then modifying Sample 6 (the c API one) to the following code:
#include <Ultralight/CAPI.h>
#include <AppCore/CAPI.h>
ULRenderer renderer = 0;
ULView view = 0;
void Init() {
ULConfig config = ulCreateConfig();
renderer = ulCreateRenderer(config);
ULViewConfig viewConfig = ulCreateViewConfig();
ULString test = ulCreateString("test");
ULSession session = ulCreateSession(renderer, false, test);
view = ulCreateView(renderer, 512, 512, viewConfig, session, 0); // The 0 is because the compiler claimed v1.4dev has a 6th parameter for display_id...however it broke regardless of whether I included it
ULString str = ulCreateString("<h1>Hello World!</h1>");
ulViewLoadHTML(view, str);
}
int main() {
Init();
}
Running Sample 6 without modifications (where it creates an app instead of a renderer) works, as do the other samples that use the C++ API.
Nice catch! That function was indeed not exported in the latest build, I'll fix it in the next release.
Fixed in latest 1.4