Forum > Debugger

view argc and argv in FpDebug

<< < (3/3)

marcov:
Windows gives a UTF16 commandline (GetCommandLineW)  that is parsed by the RTLand kept in pointer variables argc/argv for some implementation orthogonality. Argc/argv have no direct OS relevance.

In trunk, a separate wide copy is kept in argvw for unicode purposes. (paramstru).

I don't see much reason to use either of these in user programs , either go to the real OS source (getcommandlinew) or use paramstr(u)/paramcount that directly query these variables.

Thaddy:
That's what I thought. Tnx for the info on widestrings/unicode16 strings.

marcov:
See rtl/win/syswin.inc. Note that there are a lot of differences between fixes and trunk in this regard.

http://www.stack.nl/~marcov/mergelogs32/windowscmdline.html

440bx:

--- Quote from: Thaddy on February 23, 2024, 09:36:52 am ---Just curious: why argc and argv instead of ParamCount and ParamStr? Afaik they are direct mappings on Windows. (Except shortstring vs AnsiString which is in Objpas)

--- End quote ---
I'm just porting some C code that, of course, uses argc and argv. 

My goal in the port was to make the Pascal code as "parallel" to the C code as possible.  Once I have that kind of port working the same as the C code then, I "forward" the code to be "real" Pascal.

The code would actually be a lot simpler using ParamStr but, I'd have to restructure the code which is something I don't want to do in the first pass.  In the second pass, everything goes :)

That's the reason I'm (temporarily) dealing with argc and argv.

Thaddy:
Very similar to my approach.

Navigation

[0] Message Index

[*] Previous page

Go to full version