<!DOCTYPE html>
<html data-lt-installed="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="padding-bottom: 1px;">
<p>Presumably the problem is caused by calling your function from a
different thread.</p>
<p>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.<br>
</p>
<div class="moz-cite-prefix">Am 09.03.24 um 16:24 schrieb Luca
Olivetti via fpc-pascal:<br>
</div>
<blockquote type="cite"
cite="mid:7490dbd9-685f-4c0e-a38e-95cb32d3e79c@ventoso.org">I'm
writing a dll that is used by a dot net application (32bits).
<br>
<br>
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).
<br>
<br>
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).
<br>
<br>
Is there any way to solve my problem?
<br>
<br>
Bye
<br>
</blockquote>
<pre class="moz-signature" cols="72">
</pre>
</body>
<lt-container></lt-container>
</html>