Hello,
If you are targeting Windows, there is a special area in the PE
structure for a DLL that contains addresses that will be jumped to
whenever a thread gets created/destroyed. This has been used by
libtcmalloc from gperftools:
Michael Van Canneyt wrote:
I think FreeOnTerminate should not even exist. IMO it should simply
be 'True'.
This is where I strongly disagree, to me it should always be False,
because having things free up themselves at unpredictable times is a
recipe for disaster which already hit me badly.
For
Michael Van Canneyt wrote:
On Fri, 14 Dec 2018, el es wrote:
On 13/12/2018 22:23, Michael Van Canneyt wrote:
On Thu, 13 Dec 2018, Martin Frb wrote:
Besides, the documentation does not say that FreeOnTerminate
is limited to be used in the thread construction. Especially since
its
Hello,
I would use IndexStr from StrUtils:
https://www.freepascal.org/docs-html/rtl/strutils/indexstr.html
if IndexStr('subtext', ['abc','cde','fecg','hig']) >= 0 then
Regards
Dennis wrote:
is there a function like
if IsOneOf('subtext', ['abc','cde','fecg','hig']) then begin
...
Hello,
I have a Win64 DLL compiled with FreePascal 2.6.0 in which I install a
ExceptProc handler which signature is as follows:
procedure MyExceptProc(Obj: TObject; Addr: Pointer; FrameCount: LongInt;
Frame: PPointer);
Up until recently, FrameCount was greater than zero and I could walk
Sven Barth wrote:
Am 19.08.2016 09:55 schrieb "Jonas Maebe" >:
> As alluded to above, LLVM support needs to be added/tested/maintained
> separately for each supported architecture and to a lesser extent for
> each supported OS.
Hello,
We are using FPC (2.6.0) here to allow compiling our users ideas into
runable code and while this has worked just fine until now, on one
occasion we have reached a situation where the ppcrossx64 compiler ends
with an EOutOfMemory exception.
Looking at its memory consumption, sure
Lukasz Sokol wrote:
On 20/05/16 09:40, Graeme Geldenhuys wrote:
On 2016-05-20 09:36, Graeme Geldenhuys wrote:
I think a “x percentage of capacity” increment is the way to go. eg: 5
or 10%
Scrap that idea. In hind sight, % increments is what is causing the problem.
Regards,
Graeme
And
If the exe is unsigned, then Windows will complain everytime it is run.
If it is signed with a fully resolved certificate (not a self created
one), then it will show the publisher in the dialog and depending on
your security settings will either ask you if you want to be asked the
next time or
Michael Van Canneyt wrote:
The only use case that would be gained is the non-evaluation of one of
the arguments.
Yes, and that's pretty much the only use that I could think of, but it
would be very convenient when testing for a variable to be assigned and
give a default value it if is not.
Mark Morgan Lloyd wrote:
So hopefully we can drop the nasty "railroad" Americanism, since it
wasn't the original name. And hopefully we can use "syntax" in the
name, since that's what they describe. Hence "syntax chart", "syntax
diagram" or something similar. Please :-)
Where I live,
Xiangrong Fang wrote:
However, like in my first mail, if I define THandler a procedure of
object, it makes easier to SetHandler(AMethod); but how can I use that
procedure of object pointer in the so?
It works the same, cast the data you receive to a TMethod and call the
code member with the
Michael Van Canneyt wrote:
On Mon, 9 Mar 2015, Xiangrong Fang wrote:
Hi all,
I define a procedure like this:
type
TDataHandler = procedure(data: Pointer) of object;
procedure SetHandler(h: TDataHandler); external cdecl;
Now, can I implement SetHandler in a library written in C, then
it
successfully in Delphi mode!
What's even weirder is that if I replace the Plus operator by a Minus
operator, then the compilation fails.
What I was expecting is that the compilation fails in all cases.
Is there some flag that I failed to specify?
Regards
OBones
. A '-' (minus) would force some action, so
it is absolutely wrong at this place.
Thanks for the explanation on the behavior.
- Original Message - From: OBones obo...@free.fr
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Thursday, March 21, 2013 10:53 AM
Subject: [fpc
Reinier Olislagers wrote:
1. Could you please run this on other versions of Delphi and report back
the results (presumably older versions will not run the test with commatext)
I have run it with D2007, DXE, DXE2 Win32 and DXE2 Win64, all gave the
following result:
tw19610: sdf tests
Olivier SANNIER wrote:
Does any of you have any suggestion as to explain this behavior, and best of
all, how to fix it?
I went further and changed the code this so that I can get better
details as to where the exception is coming from:
program test;
uses
sysutils,
classes;
function
Jonas Maebe wrote:
OBones wrote on Wed, 22 Aug 2012:
Olivier SANNIER wrote:
Does any of you have any suggestion as to explain this behavior, and
best of
all, how to fix it?
I went further and changed the code this so that I can get better
details as to where the exception is coming from
Jonas Maebe wrote:
OBones wrote on Wed, 22 Aug 2012:
Jonas Maebe wrote:
You can try debugging syswin32_i386_exception_handler in
rtl/win32/system.pp to see what exception Win32 reports instead.
Thanks for the confirmation as I was heading that way when I posted
the message, without much
Thomas Schatzl wrote:
This code is not thread safe at all. A thread switch after the while
loop and before the increment will not prevent progress on other
threads, so multiple threads can enter the critical section.
Well, yes, even if under Windows it's rare that a thread is preempted
right in
leledumbo wrote:
That one I cannot answer, please summon Florian/Jonas/Marco/Michael/whoever
capable to answer
Would you happen to know the magical words/rhunes that I should use? g
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
Jonas Maebe wrote:
On 23 Jul 2012, at 10:58, OBones wrote:
leledumbo wrote:
I look at the generated code and in the direct one there's additional
overhead of decrementing the reference counter on each iteration.
I see it too now (I forgot about the -a option).
I can understand why
Hello all,
Let's consider the following test program:
program test;
function DirectCompute: Double;
var
k: Integer;
begin
k := 0;
Result := (k+0.5)/12;
end;
function IntermediateCompute: Double;
var
k: Integer;
begin
k := 0;
Result := k+0.5;
Result := Result / 12;
end;
begin
Jonas Maebe wrote:
Possible solutions:
a) typecast one of the operands of the division to double (not that this is
Delphi-incompatible)
b) Compile with -CF64 to force all floating point constants to become at least
64 bit in precision, even if they can be represented exactly using 32 bit
I
Hello all,
As I'm moving further into my experiments with FreePascal 2.6.0, I have
run into a strange issue related to UnicodeString comparisons.
Basically, I'm comparing the result of a function with a constant value
and find that the comparison is faster if I first assign the result of
the
Mark Morgan Lloyd wrote:
OBones wrote:
Mark Morgan Lloyd wrote:
Basically, what I was trying to do was this. In the main thread:
fIpcPipe:= CreateNamedPipe(PChar(fIpcName), PIPE_ACCESS_INBOUND,
PIPE_TYPE_MESSAGE + PIPE_READMODE_MESSAGE
Mark Morgan Lloyd wrote:
Basically, what I was trying to do was this. In the main thread:
fIpcPipe:= CreateNamedPipe(PChar(fIpcName), PIPE_ACCESS_INBOUND,
PIPE_TYPE_MESSAGE + PIPE_READMODE_MESSAGE,
1, 0, 0, 1000, NIL (* @sa *) );
That
Hello all,
I'm writing Dlls here and am also doing low level analysis of the stack
and its content.
To do that, I use the StackTop and StackBottom global variables which
used to work fine in an exe file.
Problem is, when in a DLL, StackTop is always zero and StackBottom is
the exact opposite
it sound feasible? Do you have
any advices on how best to proceed?
Thanks in advance
OBones.
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Hello,
Regular exceptions, those raised with the raise keyword are always
trapped by try..except blocks but you have to make sure that EVERY
method in the DLL that is called by the host exe has such a construct so
as not to let the exception escape.
However, there are exceptions that come
Reinier Olislagers wrote:
Morning list,
I'm trying to convert a large number of seconds to a TTime.
To my surprise - without a Delphi background ;) - EncodeTime only takes
up to 59 seconds... ;)
Same for EncodeTimeInterval
Considering that TTime is a float where the fractional part is the
Jonas Maebe wrote:
OBones wrote on Mon, 28 May 2012:
Boy, I'm having a hard day and I'm very sorry to make you waste so
much time.
Frac was here to see the impact of some changes on the issue, but the
original code that crashes is with Trunc instead of Frac so that the
comparison looks like
Hello all,
I'm compiling the program at the end of this message in x86 and x64 mode
using the following command lines:
ppc386 -MDelphi -CfSSE3 testFPU.dpr
ppcrossx64 -MDelphi -CfSSE3 testFPU.dpr
while I get an exe file and no error in x64 mode, I get the following
error message with ppc386:
Jonas Maebe wrote:
On 28 May 2012, at 15:19, OBones wrote:
Bugger, why does this keep happening to me???
Anyway, this time it is at the end.
I cannot reproduce the problem with 2.6.0/2.7.1 on Mac OS X/i386, nor with
2.7.1 on Linux/i386. I even don't see any comis* instructions in the code
Jonas Maebe wrote:
OBones wrote on Wed, 16 May 2012:
Using FPC, I'm writing a DLL that exports functions used by a given
host process.
In order to protect the host process, it is mandatory that all
exceptions are trapped in the exported function
You are probably running into
http
Hello all,
Using FPC, I'm writing a DLL that exports functions used by a given host
process.
In order to protect the host process, it is mandatory that all
exceptions are trapped in the exported function and in order to achieve
that, I have the following construct in all exported functions:
Marcos Douglas wrote:
On Tue, May 15, 2012 at 6:16 AM, Jonas Maebejonas.ma...@elis.ugent.be wrote:
Mattias Gaertner wrote on Tue, 15 May 2012:
On Tue, 15 May 2012 10:43:19 +0200
Jonas Maebejonas.ma...@elis.ugent.be wrote:
It is not possible in FPC 2.6.x. Wth the svn trunk version, you
Jonas Maebe wrote:
On 26 Apr 2012, at 17:31, OBones wrote:
Is there a way get progress information output by the compiler while building a
project?
I tried the -vt option, but I can't figure out a way to parse this and get
something like current value and max while the lines are output.
I
Jonas Maebe wrote:
OBones wrote on Mon, 23 Apr 2012:
And because I have to split my generated files so that FPC does not
hit the 2GB memory limit (which it does for a 15M source file)
What is the structure of that source code? (a few giant routines,
large constant arrays, ... ?)
Thousands
Hello,
Is there a way get progress information output by the compiler while
building a project?
I tried the -vt option, but I can't figure out a way to parse this and
get something like current value and max while the lines are output.
I also tried to look in the lazarus sources but could not
.
Is this possible? If yes, how should I proceed?
Thank you for your answers
OBones
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Hello,
I'm trying to compile the following code under FreePascal 2.6.0 :
function MyGetCurrentThreadId: DWORD; assembler;
asm
{$IFDEF WIN32}
pushecx
mov ecx,fs:[dword ptr $18]
mov eax,dword ptr [ecx + $24]
pop ecx
{$ENDIF WIN32}
{$IFDEF WIN64}
pushrcx
mov
OBones wrote:
The function starts at line 26 so the errors are about dword ptr and
abs qword ptr inside the fs and gs square brackets
What is wrong with my syntax? Is there another way to write it and get
it to work?
Ok, answering myself here, the syntax accepted by FPC is the following
michael.vancann...@wisa.be wrote:
It is currently not possible.
FPC always reads from and writes to files.
Fair enough, I'll have to deal with it then.
Thank you for your answer
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
Mattias Gaertner wrote:
Maybe you can create a ramdisk.
Thank you for your answer.
I have thought about that, but this would create deployment problems as
there is no default ramdisk driver under Windows.
Might be worth considering should performance become a really big issue.
Regards
Jonas Maebe wrote:
{$IFDEF WIN64}
pushrcx
mov rcx,gs:[abs qword ptr $30]
And this:
mov rcx,qword ptr gs:[$30]
Thanks, but does this guarantee absolute indexing?
I'm asking because the abs keyword is required when using the same code
under Delphi XE2. If I don't use it,
OBones wrote:
Jonas Maebe wrote:
{$IFDEF WIN64}
pushrcx
mov rcx,gs:[abs qword ptr $30]
And this:
mov rcx,qword ptr gs:[$30]
Thanks, but does this guarantee absolute indexing?
I'm asking because the abs keyword is required when using the same
code under Delphi XE2. If I
47 matches
Mail list logo