Actually that was very helpful and there is no need to apologise at all. I just wanted a push towards the right direction , you practically teleported me there. Don't worry I am not lazy (not claiming that you imply that I am ) , I actually enjoy investigating code so diving inside header files is not a problem at all. I dont really want or need unicode , since unicode is useful only if you want to type or print in specific languages, but even my native language Greek only needs ANSI / ASCII , not that I ever use greek in any of my code mind you , I am 100% English speaking and typing when it comes to coding. I have some things figured out that I did not mention for example I knew that TCHAR is 2 bytes when char is 1 byte because of Unicode support . However your advise just revealed to me that it was a mistake to compile my C++ code for 64 bit since that would affect those types as well. Another question I have is about const char / const long pointer , I know that const here means "not able to change value/ content" is there anything more to it ? Again thank you very much , things are much more clear now :) On Sun, Nov 20, 2016 at 1:59 AM Mark Bestley <st@bestley.co.uk> wrote:
Sorry I have not got a Windows machine here but MSDN should provide all the documentation you need. Some of these types are not translatable and have to be treated as opaque on the Smalltalk side ie just pass as data
All are defined in Windows.h and MSDN provides documentation - for types see
https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).a...
Note the naming of many of these comes from Windows 2 or earlier so was used on 16 bit programs
handle_t / HANDLE is a pseudo pointer that Windows has created and Windows system calls understand. They will dereference it to find something useful - This is similar to a POSIX file handle that you can only use as a parameter to system calls.
PVOID is a pointer to a void ie just a pointer to something
LPCTSTR and TCHAR depend on Unicode
In Wnndows C API there are usually two forms of many systems call they either take 8 bit ANSI strings or 16 bit ones which MS says is Unicode (unfortuneatly for us now MS made the decision of 16 bit when all Unicode points fitted into 16 bits so not now a simple mapping. See https://msdn.microsoft.com/en-us/library/vs/alm/dd183415(v=vs.85).aspx and https://msdn.microsoft.com/en-us/library/2dax2h36.aspx
I'll assume you want Unicode
TCHAR is then a 16 bit Unicode character LPCTSTR is a const long pointer to a 16 bit Unicode string
I would suggest finding a book or long tutorial :( and sorry I can't suggest any as I read this from Petzold books over 25 years ago
Mark
On 19/11/2016 18:51, Dimitris Chloupis wrote:
So now I need to port my CPPBridge to Windows and I have to deal with this monster. And it would not be Windows if it did not make life a lot harder , so it defines its own types.
Such types are
handle_t / HANDLE TCHAR LPCTSTR PVOID
also I will have to deal with Unicode , I have no clue how to proceed, any help is greatly appreciated.
-- Mark