Hi, 

I am trying to understand the expected behavior of Emscripten when we have 
a SIDE_MODULE that links to a standard library. 

I am having this message: 
Assertion failed: missing linked function `_emscripten_log`. perhaps a side 
module was not linked in? if this global was expected to arrive from a 
system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in 
the environment

with the following code : 

test1.c:
#include <dlfcn.h>
#include <stdio.h>
#include <pthread.h>
#include <emscripten.h>

int main(int ac, char **av)
{
  void *handle = dlopen("./libwasmdog.wasm", RTLD_LAZY);
  void (*fun_print_name)(const char *) = dlsym(handle, "print_name");
  fun_print_name(av[1]);
  /*                                                                       
                                            
    emscripten_log(EM_LOG_CONSOLE, "removing this call will brake 
linking\n");                                         
    emscripten_debugger();                                                 
                                            
  */
  return 0;
}

EMCC_FORCE_STDLIBS=1 emcc -g -s MAIN_MODULE=1 test1.c -o test.html --preload
-file ./libwasmdog.wasm -s ALLOW_MEMORY_GROWTH=1
and 
dog.c:
#include "animal.h"
#include <stdio.h>
#include <stdlib.h>
#include <emscripten.h>

void print_name(const char *type)
{
  emscripten_log(EM_LOG_JS_STACK, "\n");
  emscripten_debugger();
  printf("Je suis un %s\n", type);
}
emcc -g -s SIDE_MODULE=1 dog.c -o libwasmdog.wasm -s 
"EXPORTED_FUNCTIONS=['_emscripten_log', 
'_emscripten_debugger']"

Is this a bug, or am I doing it wrong?

Thank you!

-- 
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/470197cd-6ade-440b-a945-9e271b09c77f%40googlegroups.com.

Reply via email to