A list for the developers of CellML tools

Text archives Help


[cellml-dev] CellML wchar sizes


Chronological Thread 
  • From: lpsmith at spod-central.org (Lucian Smith)
  • Subject: [cellml-dev] CellML wchar sizes
  • Date: Tue, 1 Dec 2009 00:20:04 +0000

I have the following code in my own program:

cellml_api::CellMLBootstrap* boot = CreateCellMLBootstrap();
wstring lev;
lev = L"1.1";
m_cellmlmodel = boot->createModel(lev.c_str());

In GDB, I can look at lev.c_str()[0] - [3] and see that it is 49 46 49 00.
So far, so good. However, once the program steps into the 'createModel'
function, suddenly the passed-in string is no longer the same--it's
3014705 49 795046515 [etc etc]. And the wchar_t* is exactly the same, and
if I do a 'frame 1' to go back to my code, *that* part still sees 49 46 49
0. The net result is that 'createModel' throws an exception because the
passed-in 'version' is not what it thinks is "1.0" or "1.1".

I think I can trace this down to the fact that in order to successfully
#include <nsStringAPI.h>, I had to use the compiler flag '-fshort-wchar'.
If I don't, I get the error:

/home/lpsmith/xulrunner-sdk/include/xpcom/nsStringAPI.h:1054: error: size
of array 'arg' is negative

However, it seems you all managed to get around that incompatibility in
some other way when setting up the CellML API--there's no 'short-wchar'
flag anywhere in the Makefile that I can find. So presumably, the API's
compiled code thinks that wchar's are a different size than my own
compiled code's.

Does anyone know of a way to fix this?

-Lucian




Archive powered by MHonArc 2.6.18.

Top of page