In case someone else need this, the package tool worked for me. Reading the 
documentation again it seems to be the right way indeed. There's also a 
session about this on the "Getting Start" tutorial:
https://emscripten.org/docs/getting_started/Tutorial.html#using-files

Some important steps (I'm using CMake):
1. build the project with "-s FORCE_FILESYSTEM=1"
2. after compilation run file_packager.py [data-file] 
--js-output=[loader-file] --preload [folder/file.dat]
My example: #python file_packager.py project.data 
--js-output=data_loader.js --preload models/model1.dat
3. manage your HTML file to include and start the data_loader.js before to 
run your module 

Notes: 
- I've ran the file_packager from inside my "js" folder (my "models" folder 
is inside my "js" folder).
- you can use preload or embed but the documentation strongly suggest to 
use preload instead of embed. 

Find more informationa about it here: 
https://emscripten.org/docs/porting/files/packaging_files.html#preloading-files



Em quarta-feira, 3 de junho de 2020 20:03:00 UTC-3, Marcos Trinca escreveu:
>
> Hi there.
>
> I succesfully compiled dlib with emscripten and I'm linking my project 
> against the .a generated file using "target_link_libraries'. 
> I've got no problems instantiating some dlib classes, I can see it's 
> working, but as soon as I call dlib::deserialize() method I got an uncaught 
> exception in my browser console.
>
> The file is a .dat machine learning model.
>
> I spent the day trying to solve this problem without success. Right now 
> I'm guessing I'll need to use some kind of embed or preload flag. I 
> saw fellows using it to package the entire project and preload media 
> content but I'm not sure if my problem can be solved with this same 
> technique.
>
> I'll appreciate if anyone can share some tips poiting me to the right 
> direction!
> Thanks in advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/773b4689-5b20-4c2b-bb51-f32af8b094f6o%40googlegroups.com.

Reply via email to