De-Referencing A Pointer
James Dunne
james.jdunne at gmail.com
Tue Mar 21 07:45:11 PST 2006
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
More information about the Digitalmars-d-learn
mailing list