De-Referencing A Pointer

James Dunne james.jdunne at gmail.com
Tue Mar 21 15:30:22 PST 2006


Correct me on this if I am wrong:

UNICODE is *not* an _encoding_ standard; it is a standard mapping of 
character glyphs to integer values and specifies no requirements for 
storage or encoding.

The encoding to which you (and many others) refer to by the name of 
UNICODE is in fact UCS-2, I believe.  This is the encoding where the 
Basic Multilingual Plane (BMP) of the Unicode table maps directly onto 
65536 values.

NoBoDy wrote:
> VB6 internally stores strings in UNICODE.
> When calling external functions VB6 uses stub to convert string to/from ANSI
> format.
> 
> If you want to pass string from VB in Unicode use declaration like this:
> Declare Function findChar Lib "..." (ByVal t As LONG) As Long
> 
> and call that function as:
> retValue = findChar(StrPtr("Some string"))
> 
> this will pass pointer to UNICODE string to externall function findChar
> 
> 
> In article <dvp71g$hv1$1 at digitaldaemon.com>, James Dunne says...
> 
>>Rory Starkweather wrote:
>>
>>>>void foo(dchar c) {}
>>>>void main()
>>>>{
>>>>	foo('a');
>>>>}
>>>>
>>>>so you'll probably have no trouble there. :)
>>>>
>>>
>>>
>>>
>>>Thanks for the help. I'm still not sure how to get VB to send a dchar, but there
>>>are only a couple of possibilities. Unless you are suggesting that I pass it to
>>>D as a string and then use a conversion function on it.
>>>
>>>
>>
>>Actually you want to use wchar* at the D end from VB.  VB sends 
>>'Unicode' strings where each character is represented by two bytes. 
>>This is the equivalent of a wchar* in D.  char, wchar, and dchar in D 
>>are all more-or-less interchangeable.  The best way to get VB and D to 
>>do string work together is this:
>>
>>Declare Function findChar Lib "..." (ByVal t As String) As Long
>>
>>export extern (Windows) int findChar(wchar* str) {
>>	...
>>}
>>
>>I'm not 100% sure if this works as I've had serious issues with VB6's 
>>string handling in the past (especially in scenarios like this).  I 
>>think the trick is to initialize the string from VB's side and pass it 
>>in to C/C++/D for them to modify it.  I'll do some more research on this 
>>and get you a better answer if I can.
>>
>>-- 
>>-----BEGIN GEEK CODE BLOCK-----
>>Version: 3.1
>>GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O 
>>M--@ V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e 
>>h>--->++ r+++ y+++
>>------END GEEK CODE BLOCK------
>>
>>James Dunne
> 
> 
> 


-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O 
M--@ V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e 
h>--->++ r+++ y+++
------END GEEK CODE BLOCK------

James Dunne



More information about the Digitalmars-d-learn mailing list