FFI wide-character type?
Ron Teitelbaum
Ron at USMedRec.com
Fri Aug 4 02:21:29 UTC 2006
I found a solution that allows me to use ascii characters.
The problem I was having is that I had a squeak string 'MY' that I needed to
send to an FFI call which was expecting a wide character. In C++ I just
needed to do L"MY" to get it to work (MY represents the specific store that
I want opened in this case my personal certificates). When I tried the code
wideStringMangled := string convertFromWithConverter:
(Latin1TextConverter new). I received a string that was the same as the
regular 'MY' string in squeak. So that didn't help any. My attempts to
fake the system out didn't work either. I tried:
'L\"MY\"'
'L"MY"'
'LMLY'
"LMLYL\0"
But nothing satisfied the dll that I was passing in a wide string. I
finally found a define in the dll that allowed me to use an ascii string.
That was a long battle.
What is really needed is a patch to FFI for wide characters. At least this
problem is solved for now (unless you want to access a store that has a
Japanese name!).
Thanks for your help!!
Ron Teitelbaum
> From: John M McIntosh
> Sent: Thursday, August 03, 2006 9:46 PM
>
> Ok, assuming you are using characters ascii 0-127 you could say
>
>
> >> wideStringMangled := string convertFromWithConverter:
> >> (Latin1TextConverter new).
>
> If you are using characters 128-255 then you do need to decide what
> character set they are...
>
>
> On 3-Aug-06, at 3:38 PM, Ron Teitelbaum wrote:
>
> > John,
> >
> > Thanks for the suggestion.
> >
> > What I have is a smalltalk string. I need to send it to the external
> > function as a widestring. I tried to find a smalltalk string that
> > I could
> > try sending as char* by trying this:
> >
> > TextConverter allSubclasses collect: [:aConverter |
> > 'MY' convertFromWithConverter: aConverter new
> > ]
> >
> > I don't get anything different then a regular smalltalk string.
> >
> > So that didn't work.
> >
> > Do you have any other suggestions?
> --
> ========================================================================
> ===
> John M. McIntosh <johnmci at smalltalkconsulting.com>
> Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
> ========================================================================
> ===
>
>
More information about the Squeak-dev
mailing list
|