----boundary-LibPST-iamunique-220256095_-_-
Content-type: text/plain
Hello Frans,
I suppose
TYPE PtrSTR* = POINTER TO ARRAY [untagged] OF SHORTCHAR;
is what you need.
Found this in module WinApi.
I seem to remember PChar was added to Borland pascal in order to make interfacing to Windows easier.
Brgds,
Koen.
On Sat, 27 May 2006 00:21:06 +0200, you wrote:
>Hello Blackboxers,
>
>I want to blink a led using using Kainka's "PC Interfaces under Windows".
>The book comes with a dll - PORT.DLL - which enables communication with
>the serial ports under XP.
>With Delphi the led blinks. In BlackBox, I can't get it light. I suspect
>that my way of translating the delphi PCHAR-type
>into an array is not correct. Can I use an array as an null terminated
>string? Anyone some advice?
>
>In delphi, opening the com-port is done as follows.
>
>Function OPENCOM(S:PCHAR):Integer;stdcall; external PORT.DLL;
>
>for example: OpenCom (Pchar('COM1:9600,N,8,1'));
>OpemCom returns a 1 when connected, 0 when failed.
>
>Following my the translation of the function to component pascal
>
>INTERFACE:
>constr* = ARRAY 18 OF CHAR;
>PROCEDURE opencom* ["OPENCOM"]
>(Constr:constr) : INTEGER;
>
>TESTFUNCTION:
>open := PortDLL.opencom("COM1:9600,N,8,1");
>
>
>
>The two modules I've used.
>-----------------------
>INTERFACE
>----------------------
>MODULE PortDLL ["PORT.DLL"];
>IMPORT SYSTEM;
>TYPE
>
>constr* = ARRAY 18 OF CHAR;
>
>PROCEDURE opencom* ["OPENCOM"]
>(Constr:constr) : INTEGER;
>
>END PortDLL.
>
>----------------------------------
>TESTMODULE
>----------------------------------
>MODULE TestPort;
>
> IMPORT PortDLL, StdLog;
> VAR open: INTEGER;
>
> PROCEDURE Do*;
> BEGIN
> open := 3;
> open := PortDLL.opencom("COM1:9600,N,8,1");
> IF open = 1 THEN
> StdLog.String("Opening COM1 successful. "); StdLog.Ln
> END;
> IF open = 0 THEN
> StdLog.String("Opening COM1 failed."); StdLog.Ln
> END;
> END Do;
>
>END TestPort.
>-----------------------------------
>
>--- BlackBox
>--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-220256095_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhlbGxvIEZyYW5zLFxwYXINClxwYXINCkkgc3Vw
cG9zZSBccGFyDQpcdGFiIFRZUEUgUHRyU1RSKiA9IFBPSU5URVIgVE8gQVJSQVkgW3VudGFnZ2Vk
XSBPRiBTSE9SVENIQVI7XHBhcg0KaXMgd2hhdCB5b3UgbmVlZC5ccGFyDQpccGFyDQpGb3VuZCB0
aGlzIGluIG1vZHVsZSBXaW5BcGkuXHBhcg0KSSBzZWVtIHRvIHJlbWVtYmVyIFBDaGFyIHdhcyBh
ZGRlZCB0byBCb3JsYW5kIHBhc2NhbCBpbiBvcmRlciB0byBtYWtlIGludGVyZmFjaW5nIHRvIFdp
bmRvd3MgZWFzaWVyLlxwYXINClxwYXINCkJyZ2RzLFxwYXINCktvZW4uXHBhcg0KXHBhcg0KT24g
U2F0LCAyNyBNYXkgMjAwNiAwMDoyMTowNiArMDIwMCwgeW91IHdyb3RlOlxwYXINClxwYXINCj5I
ZWxsbyBCbGFja2JveGVycyxccGFyDQo+XHBhcg0KPkkgd2FudCB0byBibGluayBhIGxlZCB1c2lu
ZyB1c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