On Wed, Jul 27, 2016 at 02:26:17PM +0800, Fam Zheng wrote: > Signed-off-by: Fam Zheng <f...@redhat.com> > --- > Makefile.objs | 1 + > configure | 4 +-- > include/qemu/module.h | 2 ++ > include/ui/console.h | 5 ++-- > ui/Makefile.objs | 2 ++ > ui/sdl-init.c | 75 > +++++++++++++++++++++++++++++++++++++++++++++++++++ > ui/sdl.c | 19 ++++++------- > ui/sdl2.c | 26 ++++++------------ > util/module.c | 6 +++++ > vl.c | 5 +++- > 10 files changed, 111 insertions(+), 34 deletions(-) > create mode 100644 ui/sdl-init.c
[snip] > diff --git a/vl.c b/vl.c > index a455947..fdbbe47 100644 > --- a/vl.c > +++ b/vl.c > @@ -4221,7 +4221,10 @@ int main(int argc, char **argv, char **envp) > } > > if (display_type == DT_SDL) { > - sdl_display_early_init(request_opengl); > + if (!sdl_display_early_init(request_opengl)) { > + error_report("Failed to initialize SDL"); > + exit(1); > + } > } SDL has some nasty stuff where it tries to replace main() with a call to SDL_main on certain platforms. Merely #include'ing SDL.h in vl.c causes this to happen on Win32 at least, perhaps other platforms too. I'm unclear if your modularization here will apply to all platforms or just Linux - g_module at least can work on Win32. Anyway, to fully support modularization without nasty surprises, we probably want to stop this main() replacement. I sent a patch for that last year https://lists.nongnu.org/archive/html/qemu-devel/2015-08/msg01631.html Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|