Thanks for answering at first to Eric Pouech.
Referred to several points:
did you try to run your program with wineconsole ? (wineconsole /usr/client/mcc_gnu/cmpm/cmpmgnu /B100 /Oaaaa-1.ovl)
I don't know about this executable. I don't find wineconsole file anywhere in wine installation.
Does your program use global objects, which initialization code could invoke the GetStdHandle functions ?
Perhaps I'm going wrong in any of the steps I'm following. I'll explain what I'm trying to do.When I began to migrate this console based programs I wanted to migrate them entirely to Linux without using Wine. I could think of this because my Win32 console programs are designed in native C and C++ and most of its calls are related to ANSI C, and so the migration remains simplified. Console management is platform specific however. I use Win32 console API, and use structures such as INPUT_RECORD. So I'm using Event.KeyEvent.uChar.AsciiChar and Event.KeyEvent.wVirtualScanCode to get and manage keyboard inputs. So it's difficult for me to migrate these calls to, for instance, a ncurses layer, because I must redefine the complete user interface. So I thought of winelib library in order to integrate this part of the programs without changing source code. What I want is add to my program winelib the same way I'm adding other libraries. I don't want to run the program as a Win32 native one, but as a Linux native one.
So the steps I followed are:
- I installed wine package, getting it from codeweavers. - I added the include files in my source code in order to compile the programs. - I created spec file as wine documents. - I compiled it as documented. - I added the resulting .c file to my makefile. - I compiled all the modules. - I added then following libraries to my makefile linker step: -lkernel -lntdll -lwine -lwine_unicode. Tell me if that's all right. - I linked and created the executable without problems.
So, as far as I know, the only place where I call GetStdHandle is in my console module and for displaying and keyboard interface purposes.
conhanout = GetStdHandle(STD_OUTPUT_HANDLE); conhanin = GetStdHandle(STD_INPUT_HANDLE);
I don't know if the programs may have any additional implicit call to this function.
does your program use AllocConsole or FreeConsole ?
No. My program doesn't call explicitly to AllocConsole or FreeConsole.
Thanks in advance. Ignasi Villagrasa.
did you try to run your program with wineconsole ? (wineconsole /usr/client/mcc_gnu/cmpm/cmpmgnu /B100 /Oaaaa-1.ovl)
I don't know about this executable. I don't find wineconsole file anywhere in wine installation.
yes, you're right. latest codeweavers package doesn't include it yet since, this (wineconsole) includes a rather large modification of the console, and if you're concerned about maintenance, upgrading to a more recent wine is recommended
Does your program use global objects, which initialization code could invoke the GetStdHandle functions ?
Perhaps I'm going wrong in any of the steps I'm following. I'll explain what I'm trying to do.When I began to migrate this console based programs I wanted to migrate them entirely to Linux without using Wine.
your approach is perfectly valid, and if it doesn't work yet, Wine is to blame. My question was rather if your GetStdHandle calls were done in global object constructors (read *before* main gets called)
A+