Exporting symbols only for testing.

I finally tried out what I wanted to try for some time now. The problem (if you can call it a problem) I had is that one of the libs I worked on for my GSoC contained class that I wanted to test but that I did not want to expose to the rest of the world. As I did not have the time nor the knowledge to make that happen I just exported the classes so that the testcode could link against it.

Well that changed today and I took some time to figure this out. (Note: I’m not an expert on C++, libraries and such so if I do stupid things here, let me know). In the KPilot code we have an KPILOT_EXPORT define which looks like this:

#include <kdemacros.h>

# if defined(MAKE_KPILOT_LIB)
/* We are building this library */
# else
/* We are using this library */
# endif

The way I understand this snippet is that it makes the symbol that is prefixed with it visible anyhow. But what I wanted is that the symbol is only exported when the tests are enabled. Therefore I added another define which looks like this:

# if defined(HAVE_TESTS_ENABLED)
# else
# endif

To make this work I added this to the CMakeLists.txt file:

string(COMPARE EQUAL ${KDE4_BUILD_TESTS} "ON" buildtests)
macro_bool_to_01(buildtests HAVE_TESTS_ENABLED)
configure_file(config-kpilot.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kpilot.h )

And the config-kpilot.h.cmake file got a line added that looks like:


Now I can use:

class KPILOT_TEST_EXPORT IDMapperXmlSource

and the given class gets only global in the library when testing is enabled. I wondered why there is no such export in kdemacros.h as I found this quite a nice solution. The library won’t export symbols in release mode, which is a bit cleaner than just exporting everyting only to be able to test imo. But as said, I’m only a novice on this kind of things =:). This whole thing made wondering if there is some GUI tool to explore libraries.

This entry was posted in coding and tagged , . Bookmark the permalink.

6 Responses to Exporting symbols only for testing.

  1. randomguy3 says:

    This will work on Unix, but not Windows – that needs the corresponding KDE_IMPORT when using a library (as opposed to building it).

    You should probably replace

  2. vtaliso says:

    iqUPpC skqshjhlwtwq, [url=http://kqaugihfxpwy.com/]kqaugihfxpwy[/url], [link=http://ufwxnlhxnnji.com/]ufwxnlhxnnji[/link], http://gjrhycrxfuof.com/

  3. Jos says:

    Instead of using a dynamic library, you can also use a static library for doing the unit tests. Put the cpp files in a variable and the do

    add_library(mypublishedlib SHARED ${CPPFILES})
    add_library(mytestlib STATIC ${CPPFILES})
    add_executable(mytests test.cpp)
    target_link_libraries(mytests mytestlib)

  4. ihnwbynbd says:

    BKkSQW aoxvaqkjgqap, [url=http://wloivntxoovc.com/]wloivntxoovc[/url], [link=http://vpmctxoxbgvh.com/]vpmctxoxbgvh[/link], http://ttoudqwmpimu.com/

  5. Anonymous says:

    You may want to check codebases like Qt or KOffice to see how they do this ;)

  6. pkyozvruwrb says:

    dKQhBv zmiwjgqylxlv, [url=http://xnrnklumiylu.com/]xnrnklumiylu[/url], [link=http://oxtwsynwaxiv.com/]oxtwsynwaxiv[/link], http://ruzwhrhpeiii.com/

Comments are closed.

The future of KPilot

Now the Google Summer of Code approaches its end I’d like to share some thoughts on KPilot. First of these is that I was slightly surprised by the responses I got on an earlier blog. I know that there are still KPilot users but in some sense I did not really believe it. So if you are a user and want to use it in KDE4 please let us know. It is really encouraging when getting some nice message from someone out there . I know, we are not so good in keeping our website up to date, so you might also want to drop by in #kpilot on irc.freenode.org or at our personal websites. Furthermore, you can follow development activities at the KPilot ohloh site.

That said, what are the plans for KPilot? Our major goal is to release a new KPilot version with KDE 4.2. So that will be in six months or so. In the past couple of months we have done a lot of work to get KPilot syncing with akonadi and the results are promising. At the end of this GSoC (that is, after two weeks from now) we have “working” todo, contacts and calendar conduits. Working is quoted as polishing of the KPilot code as well as some kdepim/akonadi code is needed. How usefull KPilot will be at release time also depends a bit on the other kdepim applications as none of them (except mailody?) are ported to Akonadi yet if I’m correct. However at 4.2 that has changed (we hope) and therefore the following conduits will be released then:

  • calendar
  • contacts
  • file installer
  • memofile
  • time
  • todos

The results of this GSoC and the previous one is that most conduits share way more code than they did before. This should make the maintenance and bugfixing a bit easier for us.

We also slimmed down our focus. KPilot will be the application to synchronize your KDE PIM data with your palm device. This means that we will remove the old database viewers that where in it in the 3.5 series. The viewer code is old, not good working, does not have any real purpose and we do not have time/energy to work on that. In return of that you will get category synchronization for each record based conduit. I have been thinking a bit about the gui of KPilot but have no clear idea yet how it should look. So good ideas on this are welcome.

Besides the “getting things working again” again, the codebase needs a lot of clean up. But first things first. All in all, this should make KPilot should survive another KDE series.

This entry was posted in coding and tagged , , . Bookmark the permalink.

17 Responses to The future of KPilot

  1. Yep, nicely done Bertjan!! =:) I think that the refactoring and base conduit framework that we laid down last year will help more than “a bit” with keeping the code clean and manageable. I think it’ll help “A LOT”!!! =:)

    I’m also sad that we just don’t have the man-power to polish, finish, and support the keyring conduit for the initial 4.2 KPilot release. Hmmm. Actually, I think I’ll blog about that and ask our little community for help.

    As always, awesome work Bertjan!! Keep it up!! *whip crack noise* =:D

  2. yalokobdvsy says:

    cDhsQK wwwfzwndpjxw, [url=http://pwezyksdiddn.com/]pwezyksdiddn[/url], [link=http://rgoztdefygvr.com/]rgoztdefygvr[/link], http://jlsdajibxjwa.com/

  3. Anonymous says:

    I am a user of KPilot with Kontact and a Palm T3
    However I rarely sync these days after it wiped my complete adressbook once. I hope the akonadi based sync will be more stable.
    Don’t get me wrong. I think KPilot is a great piece of SW. But if users have been burnt by a big problem like loosing all addresses they will be reluctant to even try it again.

  4. Bertjan says:

    Well I use the latest stable version also and never have had problems. But I totally agree that such an erase makes one reluctant to sync. Please give it a try with the KPilot that is released with 3.5.9 and of course don’t forget to make a backup.

  5. iuxpua says:

    TusX1s jhuyyvvidtgx, [url=http://acxohrgvghus.com/]acxohrgvghus[/url], [link=http://ytcrnesbryrt.com/]ytcrnesbryrt[/link], http://ldwbhliwocqb.com/

  6. cenebris says:


    how about supporting not only palm devices but in general also psion, mobile phones, smartphones, tablets and pdas and so on? Whole KDE suite could benefit with this solution (based on akonadi). Something like http://www.mobiledit.com but free and opensource.

  7. Bertjan says:

    That is truly a good idea. I even started to think about the design and issues this would bring. It would be just too cool if KPilot could also sync my mobile phones addressbook. However, this would really be a long term feature.

  8. cenebris says:

    Well I’m aware it’s not easy nor short term task but I think KDE should have it long time ago. Maybe try to make some posts on kde planet, ask kde developers to add kpilot to kde apps (to become a standard part of kde) and so on?

  9. Bertjan says:

    There are several problems. The first is that opensync, which is a very well designed synchronization library, is more suitable as a generic synctool than KPilot (which is currently only suitable for palm devices). The problem is that we needed some features for kpilot (to quote Jason Kaspar: time synchronization, file/database installing, doing backups and restores, a daemon that doesn’t require a UI to be up to synch, and a handful of other things that people expect from palm synch solutions), which are not available in opensync. Jason tried to get syncing work with his palm but never succeeded.
    Making KPilot more device agnostic would certainly mean to get it into a shape which would much look like the opensync design
    Another problem is imo, the small scope of KPilot. It makes it also less attractive to integrate in apps as it has a relative small userbase. This can only change when more types of devices would be supported.

  10. orbnaahh says:

    TeiulK bgzcbrrxwtsk, [url=http://mqiyesmyepba.com/]mqiyesmyepba[/url], [link=http://lwytdssjcptv.com/]lwytdssjcptv[/link], http://adqqpajwfmsn.com/

  11. Anonymous says:

    I use KPilot with a T|3. But I don’t sync often because of several quirks between KDE PIM and Palm PIM. Hopefully KPilot KDE4 will be more robust and resolve some of these. For example locations entered on the T|3 will map to KDE PIM but if I put a location on the computer it will show up on the palm inside of a note. the other quirk I experience most is with recurring events and exceptions.

  12. Bertjan says:

    I have a palm m515 which doesn’t have a location field in datebook. So when I implemented it I did it by putting the location field into the note. Maybe that should be made a bit more device dependent but as I don’t have a T|3 I cannot test this.

    On the recurrence issues: It would be nice if you could come up with a step by step procedure to reproduce and a clear description to describe the bug. I sync with it for more than 2 years now and never had any great problems.

  13. zwevost says:

    tnZPVI qjlrkeifqsqt, [url=http://jmakhbpjwvog.com/]jmakhbpjwvog[/url], [link=http://izzsahxdexbn.com/]izzsahxdexbn[/link], http://ngxntbjyaogt.com/

  14. jsepdshrybj says:

    agR6kZ sluovwguabij, [url=http://zzylhpdjhqcf.com/]zzylhpdjhqcf[/url], [link=http://envbznrftatd.com/]envbznrftatd[/link], http://xxgrccargnxt.com/

  15. I wonder why functionality for synchronizing Palm devices is not included in KitchenSync – http://www.kontact.org/kitchensync/index.php – which is the default application for synchronization in KDE’s PIM suite? Why are the developers of KPilot and KitchenSync not collaborating? In response to cenebris and others, AFAIK KitchenSync is supposed to be a complete solution supporting all devices.

  16. Jan says:

    Hi Bertjan,

    thanks for keeping kpilot running! I am still using it, in KDE 3.5 at the moment, but I would like to use it in KDE4.x for a while. Until my Neo becomes as reliably as my Palm m500, actual data will reside on the latter.

    One, if not the reason you have not heard me, and others I suppose, too much in the past is that kpilot just works. Thanks again!


  17. caransac says:


    I don’t really know where to say thanks, but thanks!

Comments are closed.

Applepie monsters and the return of good old friends.

Agnes and I have had a very nice weekend. We relaxed a lot after hard a week of hard working, cleaned up the house a bit and we baked a very nice applepie. Someone here in the neighborhood has a big appletree with apples that are very suitable to bake an applepie from. So we took enough apples for our pie (yes we asked of course =:) and started to peel and cut in pieces the apples. We just started this work when Agnes gave a loud scream. I looked and asked what the problem was and discovered some creature on which I could nicely try the macro feature of our camera. This gave this picture as a nice result:

[img_assist|nid=34|title=|desc=Click for original size|link=popup|align=center|width=100|height=75]

Less nice, was that she refused to peel any apple so that I could do most of the work, sigh. I also discovered that freshly crunched cinnamon is way better than the cinnamon you get out of a supermarket can. I wish I could take photographs of smells =:( Unfortunatly I can’t but the looks where great also (I only forgot to take a picture of the final result, but I can tell you, it was delecious):


While working on the applepie the phone ringed. When I took it, I was really surprised and even more glad that our friends, which have been to Ghana for 10 months, are back and wanted to come by. We had a great evening together, joining the wether, a good meal, wine, beer and everything else they must had been missing. It was really good to see each other again and have some good talks on the balcony.

This entry was posted in coding. Bookmark the permalink.

Comments are closed.