I notice there are things I haven't understood yet. Is there any Win32 console based Winlib example. Any simple one. So I can see which process I should follow to get the program properly built.
the debugger is a pure winelib app, which heavily uses the console, so you can copy the Makefiles from it (in debugger directory from the source)
I found a little application in wine directory, wcmd, that uses Win32 console functions, and specifically GetStdHandle. I though it will be easier to control that the debugger. I built the following makefile, based on the Makefile.in in wcmd source code directory:
-----------------------------------------------------------------------------
DIRWINE = /opt/wine INCL_WINE = -I$(DIRWINE)/include/wine
### Dependencies:
WCMD_dependencies = \ batch.obj \ builtins.obj \ directory.obj \ wcmdmain.obj
# Build
wcmd : $(WCMD_dependencies) c++ -o wcmd -L$(DIRWINE)/lib \ batch.obj \ builtins.obj \ directory.obj \ wcmdmain.obj \ -lkernel32 -lntdll -luser32 -lshell32
### Rules
batch.obj: batch.c gcc $(INCL_WINE) -c -o batch.obj batch.c
builtins.obj: builtins.c gcc $(INCL_WINE) -c -o builtins.obj builtins.c
directory.obj: directory.c gcc $(INCL_WINE) -c -o directory.obj directory.c
wcmdmain.obj: wcmdmain.c gcc $(INCL_WINE) -c -o wcmdmain.obj wcmdmain.c
-------------------------------------------------------------
It builds properly wcmd executable. But running it I get a Segmentation fault (core dumped). When running it using gdb, I find the exception before main in libshell32.so library.
What am I going wrong ?
Is it possible that I have a wrong or an outdated wine version ?
I took it from codeweavers.(codeweavers-wine-20011108-5.i386.rpm). If I have to get an update, I'd like to know if there's an already built version for RH6.2 to avoid rebuilding wine package, because Codeweavers hasn't refreshed wine versions and I don't find other built versions for RH6.2.
Many thanks for helping.
Ignasi Villagrasa.
It builds properly wcmd executable. But running it I get a Segmentation fault (core dumped). When running it using gdb, I find the exception before main in libshell32.so library.
What am I going wrong ?
you should really read wine.codeweavers.com/docs/winelib-user/
what's you're missing is the complete init sequence of a winelib application you no longer can directly link your .c files directly
you need at least to initialize your application's module before your main is entered (it's why you don't get a decent output handle)
either use winemaker on your source files (winemaker is a dedicated tool designed to help you create a winelib project)
when you tried to use the wcmd Makefile, you used in fact Makefile.in, which is a template and is expanded into a real Makefile (which is pretty much more complicated than what you wrote)
so, winemaker is really your friend here
A+