Some time ago I decided to test drive Open C to see how the first release performs. Instead of writing my own code from scratch, I took an existing open source project and tried to port that to Symbian. Because once upon a time I considered writing my own XMPP Symbian implementation, I downloaded sources for
Loudmouth, an open source XMPP implementation. Without previous knowledge about Open C or Loudmouth I took the challenge. Below are some notes about my Open C tests. List is not very "scientific" and all comments are more than welcome!
Starting the work was simple: I created a new DLL-type project using Carbide and imported Loudmouth source and header files to correct directories. I was happy to see that MMP-file was updated automatically! After done that, Carbide tried to compile the project and produced a respectable amount of errors and warnings. The reason is that when compiling Loudmouth (or any other source package) to other platforms you'd use provided configuration scripts to create makefiles. For Open C that didn't work and configuration must be done manually. Basically there are two issues to solve:
- which macros to define for compilation?
- which libraries are required for linking?
Writing configuration manually is not as bad as it sounds: I created new header file named "configure.h" and copied the initial contents from skeleton file configuration.h.in. Luckily enough, the skeleton file was well commented and after a couple of trials and errors I got a working configuration file.
Because I was compiling a shared library, I had to add EXPORT_C and IMPORT_C directives by hand.
There is a nice set of string conversion utilities in directory s60opencexOpenCStringUtilitiesExLibrary. I didn't find any references to those from documentation.
When compiling the sources I had to make a couple of changes to support Symbian. There were only few places that needed fixing and/or "#ifdeffing" with __SYMBIAN32__ macro:
- glib/gi18n.h includes libintl.h that wasn't included in Open C package (bug?). I simply commented that line out.
- For target build there was error "stdapis/machine/endian.h error: impossible constraint in `asm'". I added new preprocessor directive #ifdef __SYMBIAN32__ #define _BYTEORDER_FUNC_DEFINED #endif to solve that
For IP-address resolving I found a strange issue: I wasn't able to get getaddrinfo() to work, but gethostbyname() seems to be OK. Can anyone else confirm this?
To run the application in target device, it is a must to install also the Open C runtime libraries, probably the best way to do this is to embed the required SIS files to one big installation file. Open C documentation seems to lack the list of required runtime libraries, but the information can be found from readme-file.
Readme file contains an error: UID for openc_ssl.sis is wrong in readme-file, correct uid is 0x10281F34.
After these steps I was able to run a small test application that linked with Loudmouth XMPP library and sent some XMPP messages to test server. I'm sure there are lots of things to polish if I continue work with this project, after all I haven't really tested the results of my small project. But anyway: getting an XMPP library compiled for Symbian takes much less time than reading and understanding the
actual protocol specifiction.
.
Re: An Open C test drive
JEZEQUEL Romain | 27/11/2007, 17:36
I also face a problem with getaddrinfo()... Does not seems to work....
no problem with gethostbyname!