[BLACKBOX] Using a simple DLL

From: Campbell, Robert (SELEX GALILEO, UK) <"Campbell,>
Date: Tue, 19 Feb 2008 09:38:02 -0000

----boundary-LibPST-iamunique-1206721919_-_-
Content-type: text/plain

Hi

Can anyone explain the following to me, I am
rather out of my depth & baffled?


The first module creates a small DLL.

The second two test it. It all works fine.

But when I redeclare sum by the commented line it crashes with
an illegal memory read message.


Thanks

Robert.




MODULE DemoAddFunction;

TYPE
  Real = POINTER TO RECORD z : REAL END;

PROCEDURE Addd* (a, b : REAL; sum : Real);
  BEGIN
    sum.z := a + b
  END Addd;

END DemoAddFunction.

<Q> DevLinker.LinkDll DemoAddDll.dll := DemoAddFunction# ~



MODULE DemoAddInterface ["\BlackBox\DemoAddDll"];

TYPE
  Real* = POINTER TO RECORD z* : REAL END;

PROCEDURE Add* ['Addd'] (a, b : REAL; sum : ANYPTR);

END DemoAddInterface.




MODULE DemoAddTest;

IMPORT DemoAddInterface, StdLog;

TYPE
  Real* = POINTER TO RECORD z* : REAL END;

PROCEDURE Do*;
  VAR
    sum : Real;
(* sum : DemoAddInterface.Real; *)
  BEGIN
    NEW (sum);
    DemoAddInterface.Add (2.6, 6.1, sum);

    StdLog.String ('2.6 + 6.1 :'); StdLog.Real (sum.z); StdLog.Ln
  END Do;

END DemoAddTest.

<Q> DevDebug.Unload

<Q> DemoAddTest.Do>

SELEX Sensors and Airborne Systems Limited
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-1206721919_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZ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qKioqKioqKioqKioqKioqKlxwYXINClxwYXINClxwYXIN
Ci0tLS1ccGFyDQpUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdO
T0ZGIEJMQUNLQk9YIiB0byBMSVNUU0VSVkBMSVNUUy5PQkVST04uQ0hccGFyDQp9
----boundary-LibPST-iamunique-1206721919_-_---
Received on Tue Feb 19 2008 - 10:38:02 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:01 UTC