First post, by x86++

User metadata
Rank Newbie

-O2 Optimizations
The release build of the Munt library has a compiler flag for -O3 optimization, however, the -O2 produces a ~15% smaller static library (assume similar for shared library). Also, the C flag to link with these libraries doesn't seem necessary, and removing them had no effect on the compiled code of the static library: -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32.

Reducing size of library by --strip-unneeded
In addition to -O2 optimizations, "strip" reduces the size of the binary further. The -s option to remove all symbols and relocation information results in a non-working library (tested in dosbox). However, --strip-unneeded works for both library types and reduces size of binary by ~10%; this option keeps symbols needed by relocations.

Shared library requires C runtimes
Built shared library (dll file) with C/CPP interfaces along with the optimizations -O2 and --strip-unneeded which reduces the file size by ~50%. However, it is dependent on 2 external files (C/C++ runtime libraries in the case of mingw32/gcc462) and results in a runtime error upon exiting dosbox, although the music works as expected. This error is fixed by instead static linking these C runtimes with the shared Munt library; add: -static-libgcc -static-libstdc++ to the cmake option: CMAKE_SHARED_LINKER_FLAGS.

Attached this shared library (version d419d36) for verifying that it works in Windows.


  • Filename
    File size
    249.99 KiB
    File comment
    win32 version of Munt shared library with C/CPP interfaces
    File license
    Fair use/fair dealing exception