PureBytes Links
Trading Reference Links
|
Andrew,
You can achieve this, however you receive the pointer ByVal in your function
to pass a variable ByRef. I program in basic so I'll give a simple example
in basic: (written in the email editor so be careful) I think the only types
of variables you can pass this way are Floats. I'm not sure if you can pass
arrays or not (any info would be appreciated as I haven't figured that one
out yet).
{EL Code}
DefineDLLFunc:"c:\test.dll",Long,
"TestByRef",Float, {Last Price}
LPFloat;{parameter you want to pass ByRef}
{You can call other variables like this using the LP suffix in front of
the variable type I understand you should avoid passing Inputs ByRef. Assign
them to a variable first then pass}
Value1 = TestByRef(Close, &Value2); {Note the & in front of the Value2}
{PB Code}
Global PrevLast as Single
Function TestByRef(Byval Last as Single, Byval TickType as Single PTR)
Export as Long
Dim Tick as Single
'Count up/Down/Neutral Ticks
If Last > PrevLast Then
Tick = 1
Elseif Last < PrevLast Then
Tick = -1
End If
PrevLast = Last
@TickType = Tick
Function = 1
End Function
Patrick White
----- Original Message -----
From: "Andrew Peskin" <andrew@xxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Cc: <omega-list@xxxxxxxxxx>
Sent: Tuesday, July 24, 2001 10:58 AM
Subject: Passing ByRef (a Pointer) ... Is it possible in EL?
I would like to call a function in EL, passing some of the parameter
ByRef, so I can modify them in the function, and allow the calling
routine to use the new values of theses variables. In BASIC it would be
analogous to passing something ByRef or in C/C++ passing a variable
pointer. Is this possible to do in EL. If it is, how would you do it?
Andrew
|