Re: [fpc-pascal] opening a serial port in a dll called from dot net fails

2024-03-11 Thread Elmar Haneke via fpc-pascal
Presumably the problem is caused by calling your function from a 
different thread.


Perhaps it is a solution to put the SerOpen in a thread created by FPC 
and signal that thread from your dot-net-called function.


Am 09.03.24 um 16:24 schrieb Luca Olivetti via fpc-pascal:

I'm writing a dll that is used by a dot net application (32bits).

If I call SerOpen in the initialization section of the dll there is no 
problem, but if I call it from one of the exported functions it gives 
me an access denied (GetLastError gives me a 5), and I really need to 
call it from a function (due to some quirks in the calling program 
which is not under my control).


A search in the usual places tells me that in dot net opening a serial 
port with CreateFile (which is what SerOpen does) is forbidden, that 
you should use the SerialPort class (which I don't think I can do from 
my dll written in freepascal).


Is there any way to solve my problem?

Bye
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Pointer question

2023-08-10 Thread Elmar Haneke via fpc-pascal

1) what does "i := x - x;" do and what is it's purpose and why doesn't "x + x" 
work the same?


Subtracting pointers may be useful if they point to consecutive memory. 
The Result is the number of bytes between both addresses.


Adding pointers is useless, you would get a pointer pointing to some 
address in address space which has no relation to the pointers — 
presumably accessing it would rise an error.


Therefore, it is a good idea to let the compiler prevent such mistakes.


2) I've used pointer equality of course but what does "x > p" do and what is 
its purpose?


It may be useful if pointers do point into a continuous data object, 
e.g. a write-pointer inside a buffer.


Elmar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] IRC channel for FreePascal support ?

2023-04-18 Thread Elmar Haneke via fpc-pascal

Just my comments on IRC-Channels.

I did enter the rooms #fpc #lazarus #lazarus-ide #fpc-alt #fpc-dev just 
to see whats going on on these channels a few days before.


I have been contaced by johanna via direct talk asking some questions i 
I'm able programming pascal, something like how to bring numbers to 
worded form (with explicit annotation not o google), and what I did 
program in pascal before an if she can get a copy.


Strange/curious behavior at all.

On today I got the notice that I'm banned from #fpc - obvious reason: 
not to post


The Channels seem to be empty there is no traffic inside.

Elmar



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] bug or feature?

2022-02-14 Thread Elmar Haneke via fpc-pascal



This can't be right, can it?

type
   TBird = class
 procedure Fly;
   end;
   TEagle = TBird; // alias

procedure TEagle.Fly;
begin
end;



It does depend on what you expect an Type-Alias to be.

If you expect the compiler to generate an compatible class then your 
example must not be compilable.


If you expect an alias die make the Typenames "TEagle" and "TBird" 
equivalent it is no problem for the compiler which name you use at what 
place.


In any case I would judge such code as "bad style" - programmers should 
avoid doing so.



Elmar


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal