On Wed, 10 Jun 2009, Szak�ts Viktor wrote:

Hi,

> As subject, hb_DirBase() and hb_ProgName() will correctly
> return the value, except that it uses forward slashes instead of
> backslashes on dos/djgpp platform.
> I've added this workaround to hbmk2:
>    #define HB_DIRBASE()         StrTran( hb_DirBase(), "/", "\" )
> Any chance to add a fix to hbvm? I don't want to mess it up.

By default DJGPP tries to emulate *nix environment as close as possible
and it makes quite well. Many different things can be emulated like
unlimited (in practice) command line length (you do not have to worry
about it in hbmk2 when gcc is executed) or automatic wildcard expansion
(this feature is disabled by harbour core code). It also tries to use
'/' instead of backslashes in argv[0] and the above effects hb_dirBase()
results. It can be disabled quite easy for argv[0] but many other functions
will still return '/' in path instead of '\'. You can see it in file name
returned by hb_FTempCreate*() or using curdir().
Also system() command by default tries to execute given command using SHELL
instead of COMSPEC. 
BTW the above is the answer for your NOTE in hbmk2 code:
   /* NOTE: For some reason DJGPP gcc launched from Windows builds
            (win/dos cross-build scenario using -arch=dos switch)
            won't work when external script usage is attempted:
            ---
            gcc.exe: @c:/devl/djgpp/tmp\lxwp3x.cpl: No such file or directory 
(ENOENT)
            gcc.exe: no input files
            ---
            I have no idea why, tried to execute using hb_run(),
            tried with the same filename parameter as the DOS build
            generated, to no avail. Interestingly same *gcc in link mode*
            doesn't suffer from this problem on equal conditions.
            This hack will introduce command line size limitations,
            which can be overcome by using -inc hbmk2 switch.
            [vszakats] */

Just simply shell uses '\' in temporary file name as escape character so
SHELL envvar is the reason of your problems not cross build so workaround
you added does fix anything and probably it was working only due to
different environment settings in both builds.
I'll disable using '/' in argv[0] and set COMSPEC as prefered shell for
system() command in DJGPP builds anyhow please remember that some system
function will return '/' instead of '\' in directories.

best regards,
Przemek

ps. in *nixes I can use:
       hbmk2 tst
    to create binaries from tst.prg but in DOS ir prints:
       hbmk: Error: No source files were specified.
    and I have to use .prg filename with extension, i.e.:
       hbmk2 tst.prg
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to