Calling Convention stdcall (Windows API)
----boundary-LibPST-iamunique-402911554_-_-
Content-type: text/plain
Thanks for your replies regarding initializing records.
Calling the Windows API in a less conventional way (instead of MODULE
MyInterface ["MyDll"];) another question arose:
What is the calling convention used in Blackbox? Is it [stdcall] by default?
There was no sysflag to say PROCEDURE [WINAPI]...
MODULE ZeroMemory;
IMPORT S := SYSTEM, W := WinApi;
TYPE
TestRecord = RECORD[untagged]
value: INTEGER;
string: ARRAY 16 OF SHORTCHAR;
END;
RTLZEROMEMORY = PROCEDURE (address: W.PtrVoid; size: INTEGER);
VAR
RtlZeroMemory: RTLZEROMEMORY;
mod: W.HMODULE;
PROCEDURE Test*;
VAR
r: TestRecord;
BEGIN
...
RtlZeroMemory(S.ADR(r), SIZE(TestRecord));
...
END Test;
BEGIN
mod := W.LoadLibrary("Kernel32.DLL");
RtlZeroMemory := S.VAL(RTLZEROMEMORY, W.GetProcAddress(mod,
"RtlZeroMemory"));
END ZeroMemory.
Thanks,
Philipp
Info:
Another option where S := SYSTEM:
PROCEDURE MemSet (address: INTEGER; value: BYTE; size: INTEGER);
VAR
i: INTEGER;
BEGIN
FOR i := address TO (address + size) - 1 DO
S.PUT(i, value);
END;
END MemSet;
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Current posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-402911554_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmY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