Re: mySQL and SQLDriverConnect

Nick Gorham <[email protected]>
Newsgroups gmane.comp.db.unixodbc.devel
Message-ID <[email protected]>
Igor Korot wrote:

>>>      
>>>
>>By the way, when you say you explicitly call the non unicode function, 
>>do you mean you call SQLDriverConnectA, becaue with UNICODE defined 
>>SQLDriverConnect becomes SQLDreiverConnectW (as it does in windows)
>>    
>>
>
>retcode = SQLDriverConnect( m_hdbc, parentWnd, (SQLTCHAR FAR *)"DSN=test;", ...);
>                                                ^^^^^^^^^^^^^^
>
>I am doing casting of the parameters.
>In UNICODE version, this would become (SQLWCHAR FAR *).
>
>So, unless the linker is not smart, he should look at the proper signature of the
>function.
>
>  
>
Not entirly correct

(SQLTCHAR FAR *)"DSN=test;"

when UNICODE is defined, will create a SQLWCHAR * pointer, but the thing it points to will still be a char string;

I think thats the problem, you are passing the address 8bit string into a function thats expecting a 16bit sequence of values. Casting the pointer to a pointer of another type will not alter the thing thats being pointed to.

Remember C will do what you tell it to, even if thats not what you want it to do :-)

-- 
Nick


_______________________________________________
unixODBC-dev mailing list
[email protected]
http://mail.easysoft.com/mailman/listinfo/unixodbc-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.