|
Home > Archive > SQL Anywhere ultralite > January 2006 > Visual Studio 2005: PocketPC Development with UL C++ component interface
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Visual Studio 2005: PocketPC Development with UL C++ component interface
|
|
| Markus Hofer 2006-01-09, 8:24 pm |
| I'm currently porting a PocketPC 2003 application from EVC4 to Visual Studio
2005. I'm using the C++ component interface of ASA 9.02 Ultrilite (with the
newest EBF).
It seems that the provided libraries (e.g. ulrt.lib) is not compatible with
Visual Studio 2005. The main reason is, that Visual Studio 2003 treats
wchar_t as builtin type, while the Ultralite libraries assume that wchar_t
is just an alias for unsigned short. This results in some unresolved
externals when linking the application: the linker is looking for methods
with native "wchar_t"-parameters while the library provides only methods
with "unsigned short"-parameters.
Are these compatibility problems known and if yes when will a fix be
available so that development of PocketPC applications can be done with the
current version of Visual Studio / Visual C++.
Markus Hofer
Smart Solutions AG
| |
| Markus Hofer 2006-01-12, 11:23 am |
| For people who do not want to wait for Sybase to provide UL libraries for
Visual Studio 2005, here some short instructions how to work around the
problem.
1. in the header file ulglobal.h look for the line "typedef wchar_t
ul_wchar" and change it to "typedef unsigned short ul_wchar"
2. in the header file ulstore.h look for the line "typedef wchar_t
rp_wchar" and change it to "typedef unsigned short rp_wchar"
3. provide explicit casts to (const ul_wchar*) where necessary
With these first two changes the program should compile and link correctly,
but probably won't work as it should: Because the sybase code still uses
unsigned short as wide character datatype and PocketPC uses wchar_t native
type, automatic data conversion and assignment might no longer work as
expected.
Example:
ULValue MyValue(L"My initial string");
MyValue = L"My example string";
This code will not work correctly, because the compiler chooses the wrong
assignment operator resp. constructor. To make this work again, you should
cast the string as shown below.
ULValue MyValue( (const ul_wchar*) L"My initial string");
MyValue = (const ul_wchar*) L"My example string";
Markus Hofer
Smart Solutions AG
Switzerland
"Markus Hofer" <mh(at)smartsol.ch> wrote in message
news:43c2cd29@forums
-1-dub...
> I'm currently porting a PocketPC 2003 application from EVC4 to Visual
Studio
> 2005. I'm using the C++ component interface of ASA 9.02 Ultrilite (with
the
> newest EBF).
>
> It seems that the provided libraries (e.g. ulrt.lib) is not compatible
with
> Visual Studio 2005. The main reason is, that Visual Studio 2003 treats
> wchar_t as builtin type, while the Ultralite libraries assume that wchar_t
> is just an alias for unsigned short. This results in some unresolved
> externals when linking the application: the linker is looking for methods
> with native "wchar_t"-parameters while the library provides only methods
> with "unsigned short"-parameters.
>
> Are these compatibility problems known and if yes when will a fix be
> available so that development of PocketPC applications can be done with
the
> current version of Visual Studio / Visual C++.
>
> Markus Hofer
> Smart Solutions AG
>
>
| |
| Mike Vander Ploeg 2006-01-12, 8:23 pm |
| As you have said, in VS 2005, Microsoft's compilers define the wchar_t type
as the native __wchar_t type be default, while in previous versions of their
compilers wchar_t was defined as unsigned short. The UltraLite runtimes are
compiled with the older compilers and so use unsigned shorts for wchar_t
types.
You can revert the new compilers to the old behaviour by using the
/Zc:wchar_t- option. Providing this option will allow new apps compiled
with VS 2005 to link successfully with the current UltraLite runtimes. In
VS 2005, you can set the "Treat wchar_t as Built-in Type" property in the
C/C++ -> Language property page to "No".
The following article in the MSDN describes this compiler option:
http://msdn.microsoft.com/library/d...rfzcwchar_t.asp
We currently have no plans to ship new runtimes that use the native
__wchar_t type.
Mike Vander Ploeg
iAnywhere Solutions
"Markus Hofer" <mh@smartsol.ch> wrote in message
news:43c67b8f@forums
-1-dub...
> For people who do not want to wait for Sybase to provide UL libraries for
> Visual Studio 2005, here some short instructions how to work around the
> problem.
>
> 1. in the header file ulglobal.h look for the line "typedef wchar_t
> ul_wchar" and change it to "typedef unsigned short ul_wchar"
> 2. in the header file ulstore.h look for the line "typedef wchar_t
> rp_wchar" and change it to "typedef unsigned short rp_wchar"
> 3. provide explicit casts to (const ul_wchar*) where necessary
>
> With these first two changes the program should compile and link
> correctly,
> but probably won't work as it should: Because the sybase code still uses
> unsigned short as wide character datatype and PocketPC uses wchar_t native
> type, automatic data conversion and assignment might no longer work as
> expected.
>
> Example:
>
> ULValue MyValue(L"My initial string");
> MyValue = L"My example string";
>
>
> This code will not work correctly, because the compiler chooses the wrong
> assignment operator resp. constructor. To make this work again, you should
> cast the string as shown below.
>
> ULValue MyValue( (const ul_wchar*) L"My initial string");
> MyValue = (const ul_wchar*) L"My example string";
>
>
>
> Markus Hofer
> Smart Solutions AG
> Switzerland
>
>
>
>
>
>
> "Markus Hofer" <mh(at)smartsol.ch> wrote in message
> news:43c2cd29@forums
-1-dub...
> Studio
> the
> with
> the
>
>
| |
| Markus Hofer 2006-01-13, 7:23 am |
| Mike
Thanks a lot for your answer. I was aware of the /Zc:wchar_t- option and
also did some test with this option. The result was, that it does not work
if you use MFC and/or ATL. MFC as well as ATL for Smart Devices in Visual
Studio 2005 assume that "Treat wchar_t as built in type" is true.
> We currently have no plans to ship new runtimes that use the native
> __wchar_t type.
This means that Sybase does not longer support MFC applications with
Ultralita on PocketPCs and MS Smartphones developed with Visual Studio 2005.
Is this really the intention of Sybase/iAnywhere?
Best Regards
Markus
Smart Solutions AG
"Mike Vander Ploeg" < mvanderp_asdf@sybase
.com> wrote in message
news:43c6b2e8$1@foru
ms-1-dub...
> As you have said, in VS 2005, Microsoft's compilers define the wchar_t
type
> as the native __wchar_t type be default, while in previous versions of
their
> compilers wchar_t was defined as unsigned short. The UltraLite runtimes
are
> compiled with the older compilers and so use unsigned shorts for wchar_t
> types.
>
> You can revert the new compilers to the old behaviour by using the
> /Zc:wchar_t- option. Providing this option will allow new apps compiled
> with VS 2005 to link successfully with the current UltraLite runtimes. In
> VS 2005, you can set the "Treat wchar_t as Built-in Type" property in the
> C/C++ -> Language property page to "No".
>
> The following article in the MSDN describes this compiler option:
>
http://msdn.microsoft.com/library/d...rfzcwchar_t.asp
>
> We currently have no plans to ship new runtimes that use the native
> __wchar_t type.
>
> Mike Vander Ploeg
> iAnywhere Solutions
>
> "Markus Hofer" <mh@smartsol.ch> wrote in message
> news:43c67b8f@forums
-1-dub...
for[color=darkred]
native[color=darkred
]
wrong[color=darkred]
should[color=darkred
]
(with[color=darkred]
methods[color=darkre
d]
methods[color=darkre
d]
>
>
| |
| Mike Vander Ploeg 2006-01-13, 11:23 am |
| Thank you, Markus, for your input regarding this issue. It has initiated a
fair bit of internal discussion here. I'll send another reply once we have
decided how to resolve it.
Meanwhile, the work-around you proposed to change our two header files and
add explicit casts to your code should work, because __wchar_t and unsigned
short should be binary compatible.
Mike
"Markus Hofer" <mh@smartsol.ch> wrote in message
news:43c78726@forums
-2-dub...
> Mike
>
> Thanks a lot for your answer. I was aware of the /Zc:wchar_t- option and
> also did some test with this option. The result was, that it does not work
> if you use MFC and/or ATL. MFC as well as ATL for Smart Devices in Visual
> Studio 2005 assume that "Treat wchar_t as built in type" is true.
>
> This means that Sybase does not longer support MFC applications with
> Ultralita on PocketPCs and MS Smartphones developed with Visual Studio
> 2005.
> Is this really the intention of Sybase/iAnywhere?
>
> Best Regards
>
> Markus
> Smart Solutions AG
>
> "Mike Vander Ploeg" < mvanderp_asdf@sybase
.com> wrote in message
> news:43c6b2e8$1@foru
ms-1-dub...
> type
> their
> are
> http://msdn.microsoft.com/library/d...rfzcwchar_t.asp
> for
> native
> wrong
> should
> (with
> methods
> methods
>
>
| |
| Mike Vander Ploeg 2006-01-26, 4:56 pm |
| We have decided to ship a new runtime built with the VS 2005 compiler. It
will be available in the next 9.0.2 EBF.
Mike
"Mike Vander Ploeg" < mvanderp_asdf@sybase
.com> wrote in message
news:43c7daf2$1@foru
ms-2-dub...
> Thank you, Markus, for your input regarding this issue. It has initiated
> a fair bit of internal discussion here. I'll send another reply once we
> have decided how to resolve it.
>
> Meanwhile, the work-around you proposed to change our two header files and
> add explicit casts to your code should work, because __wchar_t and
> unsigned short should be binary compatible.
>
> Mike
>
> "Markus Hofer" <mh@smartsol.ch> wrote in message
> news:43c78726@forums
-2-dub...
>
>
| |
| Markus Hofer 2006-01-30, 11:24 am |
| Thats good news! As I belive that's a wise decision: MFC is still an
important framework - .NET is still way too slow for many applications.
Markus
"Mike Vander Ploeg" < mvanderp_asdf@sybase
.com> wrote in message
news:43d8ef98$1@foru
ms-1-dub...
> We have decided to ship a new runtime built with the VS 2005 compiler. It
> will be available in the next 9.0.2 EBF.
>
> Mike
>
> "Mike Vander Ploeg" < mvanderp_asdf@sybase
.com> wrote in message
> news:43c7daf2$1@foru
ms-2-dub...
initiated[color=dark
red]
and[color=darkred]
and[color=darkred]
Visual[color=darkred
]
runtimes[color=darkr
ed]
wchar_t[color=darkre
d]
compiled[color=darkr
ed]
http://msdn.microsoft.com/library/d...rfzcwchar_t.asp[color=darkred]
libraries[color=dark
red]
as[color=darkred]
Visual[color=darkred
]
unresolved[color=dar
kred]
be[color=darkred]
>
>
|
|
|
|
|