Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by 440bx on Today at 10:05:27 pm »
If it works correctly when called accordingly (namely by not passing a pointer or by dereferencing it) it does not make it incorrect. It is simply not equivalent to how it's declared in MSDN.
I'm afraid I have to disagree.  It is incorrect.  One of the reasons (yes, there is more than one) it is incorrect is because there is no documentation of FPC's "flavor" (that's the diplomatic word, the accurate word is _wrong_) of WriteFile.  This means that when a Pascal programmer looks up how to call WriteFile, that user is going to find (apparently, "surprisingly" to some Pascal programmers) the MSDN definition and its documentation.  After the unsuspecting soul codes the call to WriteFile as specified by MS, a "miracle" happens: it doesn't work BUT, some Pascal programmers here (you among them) say the FPC WriteFile definition isn't wrong, the guy just didn't read the right (likely non-existent) FPC WriteFile documentation.

There is one thing I must agree with you: the definition is not "equivalent", definitely not.  We are in complete agreement.

If one knows how, one can still treat it as optional:

Code: Pascal  [Select][+][-]
  1. WriteFile(h, buf, SizeOf(buf), DWord(Nil^), Nil);
Of course, why do it right when it can be done wrong and work around the wrong definition by using a rather questionable trick.  The whole purpose of "var" is to specify that a _reference_ is required.

2
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by paule32 on Today at 10:00:37 pm »
@PascalDragon:

you made my day !
Thank you.
3
General / Re: The weird Rewrite bug
« Last post by PascalDragon on Today at 09:58:53 pm »
I don't know what exactly is going on in your code, but when using the DOS file assign/read/write procedures, you must check the IOResult generated by the OS each time you read or write a block of data to the file, not just after opening it.  IOResult is a simple integer value generated by the OS' I/O Routines, and reading it resets it to zero. Failing to read/reset it will get you into trouble with the next IO Access. I found in BP times that handling this correctly may be a bit tricky.

This depends on the setting of the {$I} switch. If it is {$I-} then one needs to check IOResult manually. If it is {$I+} then the compiler will automatically insert checks that trigger a runtime error. If the SysUtils unit is used in the program that runtime error will be converted to a EInOutError and thus can be handled using ordinary Object Pascal exception handling.
4
General / Re: Assign (textfile) not compiling - sometimes.
« Last post by PascalDragon on Today at 09:51:50 pm »
If it were a beginner I would rephrase it. The one that made the suggestion is no beginner.
Assign() and Close() existed before some idiots mixed up the language without thinking.
Fixing a symptom without analyzing the cause is plain ignorance.
And this is such a case that is not only obvious, but obnoxious. IOW toxic language pollution.

Complaining about it doesn't help that AssignFile and CloseFile are the solutions the developers of Delphi had come up with to use in context of working with VCL components. And thus one should suggest teresa to either use those or - as done by TRon - System.Assign and System.Close without doing an unrelevant rant about why the Delphi developers did what.
5
Other / Re: Question for people who have built commercial apps
« Last post by PascalDragon on Today at 09:44:32 pm »
At the company I work at - we're producing backup software as well as software to delete disks for example - we have both free versions of our products that are restricted in their functionality (and speed) as well as in various levels more feature rich variants till the “Enterprise” variants that allow cloning/deleting of multiple disks at once.

For us that works rather well as more or less every user can find their needed edition without really cannibalizing higher editions.
6
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by TRon on Today at 09:40:10 pm »
in general, you would not making a question on a question.
That is not gentle.
It is the same gentleness you provided the reader with omission of details. And the question itself was a hint.

Please enlighten me how I should answer your questions so that they meet your expectations and standards.

Quote
I can not ask your question's, because I don't know that FPC needs so many compilerproc functions, and procedures.
As such, I would be expect, that FPC sould me let to make/compile my own stuff.
As such, I would be expect, that you can help me with working things.

For me, I can not claim, that you give anything.
But I would expect solutions (so little they are) - and not the things like: "use existing code.".
I rest my case. I got better things to do with my time than copy-pasting existing implementations.

edit: you seem to misunderstand that writing your custom RTL means that you are the one that set the rules not us the reader but you keep failing to inform. To me it looks like you are just YOLO-ing things and expect answers when you got yourself into trouble.
7
FPC development / Re: what to do if my target MIPS cpu has no FPU
« Last post by PascalDragon on Today at 09:36:59 pm »
some advises?

You might need to add

Code: Pascal  [Select][+][-]
  1. {$define cpufpemu}

to the MIPS related defines in compiler/fpcdefs.inc. I have not tested however whether that is enough.

But I am on topic.

You are absolutely offtopic, because as usual you did not read and understand the original post to grasp what this topic is about: It is about using/enabling the software floating point support provided by the compiler for a specific target, not about using fixed comma arithmetic.
8
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by PascalDragon on Today at 09:28:53 pm »
By looking how microsoft has designed it to be.
Code: Pascal  [Select][+][-]
  1. function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD; var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; stdcall; external 'kernel32.dll' name 'WriteFile';
  2.  
And the definition of WriteFile you showed violates the advice you gave.

WriteFile's Buffer parameter should NOT be untyped.  That is incorrect.

If it works correctly when called accordingly (namely by not passing a pointer or by dereferencing it) it does not make it incorrect. It is simply not equivalent to how it's declared in MSDN.

Also, the lpNumberOfBytesWritten should NOT be a "var" parameter because, except in Windows 7, that parameter is optional, therefore it should be typed as a _pointer_ to DWORD.

If one knows how, one can still treat it as optional:

Code: Pascal  [Select][+][-]
  1. WriteFile(h, buf, SizeOf(buf), DWord(Nil^), Nil);
9
General / Re: How to: create DLL file for Windows 10 64-Bit Pro
« Last post by paule32 on Today at 09:24:19 pm »
in general, you would not making a question on a question.
That is not gentle.

I can not ask your question's, because I don't know that FPC needs so many compilerproc functions, and procedures.
As such, I would be expect, that FPC sould me let to make/compile my own stuff.
As such, I would be expect, that you can help me with working things.

For me, I can not claim, that you give anything.
But I would expect solutions (so little they are) - and not the things like: "use existing code.".
10
Please let me have a checkbox "display in dateformat".

Often I have data in the format double, e.g. 45122.

That should now be fully possible in 3.99. See image.

In the image, it has been set to show both, the human readable date, and the float. That can be configured. (red box)

You can also configure the format for the date (see https://www.freepascal.org/docs-html/rtl/sysutils/formatchars.html ). (green box)
Different formats can be given for each type (TDate, TTime, TDateTime). So you can decide what happens if a TDate has a time different from 0.

You can add other types (yellow box), if you have your own
Code: Pascal  [Select][+][-]
  1. type TMyTime = double;


You can also repeat the config, and add different setting for different nest levels. That is values shown in the array could be shown shorter.
If the array gets expanded (and each element listed in its own line) then those expanded values are at nestlevel = 0 (top level).
But in the single line display, where all array entries are coma separated, they are at level=1 (or in the case where the array is in a record, they are at level 2)

You can also set the formatter for each watch. (blue box / watch properties)
- You can disable the formatter
- You can choose a specific one (if you have set up formatters with different format-string yyddmm...)
- You can set up formatters inactive (Not checking the checkbox in the options list), and those will not be applied unless specifically selected in the watch properties)

There is a topic on "value formatters" https://forum.lazarus.freepascal.org/index.php/topic,66186.0.html


From the thread https://forum.lazarus.freepascal.org/index.php/topic,66398.msg508570.html#msg508570

It would be nice if the characters in a null terminated array of characters were displayed without single quotes and without commas separating them.

I added a value formatter, that will show an array of char as string.

You can add the value converter (global or per project).
- To add a new formatter, first select the type-of-formatter in the drop down, then press add.
- "match type by name" (brown box) you would probably want an "*", so it acts on any typename. (It will only act if it is an array of char).
- There is a checkbox (brown box), to select if it should stop at the last char before the first #0  encountered.
- You do want "Replace/Hide original value", or the array data is shown on the same line before/after the string.

It only changes the displayed value (and what gets copied to clipboard). At current it does not prevent the watches window from showing a [ + ] symbol to expand the array.

Please test.
Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018