XMPP Today I’ve made first steps in developing the small jabber client that would suite my needs. I know it sounds retarted: just one more client, but I have tried almost all of them and hadn’t found my “silver bullet”. As far as I want it to be GTalk-compatible, the libjingle seems to be the only choice for the backend. The general build of this library runs smoothly as long as you follow the instructions in readme file 🙂 The first problem that had risen was how to use libjingle in the managed application.


The main issue there is that by default libjingle is built using static runtimes, while /clr option for managed C++ requires the DLL runtimes. Thus when you try to link the libjingle’s “.lib” files into the managed app it produces a lot of “symbol already defined” errors. The obvious way to solve is to build the libjingle using the dynamic runtimes. To do so you need to make few changes in “main.scons” file:

win_env.Append(
  COMPONENT_LIBRARY_PUBLISH = True,  # Put dlls in output dir too
  CCFLAGS = [
   # ...skipped...
    '/wd4996',      # ignore POSIX deprecated warnings
    '/wd4275',      # ignore the warning on exporting class that was derived from non-exported (!!!)
   # ...skipped...
  ],

# ...skipped...

win_dbg_env.Prepend(
  CCFLAGS = [
      '/ZI',     # enable debugging
      '/Od',     # disable optimizations
      '/MDd',    # link with MSVCRTD.LIB (multi-threaded, dynamic linked crt) (!!!)
      '/RTC1',   # enable runtime checks
  ],

# ...skipped...

win_opt_env.Prepend(
  CCFLAGS=[
      '/Zi',     # enable debugging
      '/O1',     # optimize for size
      '/MD',     # link with MSVCRT.LIB (multi-threaded, dynamic linked crt) (!!!)
      '/GS',     # enable security checks
  ],

Changing the “/MT” and “/MTd” to “/MD” and “/MDd” is pretty obvious. Suppressing the warning 4275 is required because flag to treat warnings as errors is set and there is at least one file that throws this warning. It is a quick hack and I am going to check if it is possible to fix it with changes in the code when I have more time. Then you can run the build again. The output “.lib” files are ready to use in managed code, however you will also need to add at least the following libraries to dependencies in managed part to get rid of the “unresolved external symbol” errors completely:

  • wsock32.lib
  • ws2_32.lib
  • Advapi32.lib