[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

External DLLs in TS7 vs. 2000i



PureBytes Links

Trading Reference Links

Hello,

(This e-m is being individually sent to several Omega / TradeStation
lists which have previously had TradeStation DLL threads.}

This e-m is to outline some behavior I'm seeing using a DLL w/TS
2000i vs. v7.  If anyone else has seen this behavior, or can shed
light on it, I'd love to hear it.  Otherwise perhaps this can help
someone who's currently (or planning) to use a DLL w/v7.

1. When using a 'legacy' DLL (that written to export to the
Dll_{Add,Context,Free()} APIs introduced in 2000i) w/TS7 I've noticed
that it does not appear to unload the DLL when an indicator using the
DLL is removed from a chart.

I log to a file when my DLL starts and stops.  Using 2000i (and I
believe v6) I see a log entry for both the DLL startup and shutdown.

Using TS7 I see only the log entry for the startup.  In addition
after shutting down TS7 I notice that orchart.exe remains running (as
seen using TaskMan).  When I kill orchart.exe my DLL is unloaded.

It appears that this is one manifestation of a bug (gasp!) in TS7.
The other manifestation is as follows:

Suppose I open a workspace and add an indicator (which uses my DLL).
I then close the workspace (either deleting the indicator or not, it
doesn't change the behavior).  I still have a orchart.exe running.  I
re-open the workspace, now I have two orchart.exes running.  I add my
indicator and close the workspace, still have two orchart.exes
running.  I re-open the workspace, now I have three orchart.exes
running.

>From the behavior it seems that someone forgot to do a FreeLibrary()
someplace...

2. I've also noticed that the use of Dll_Add() / Dll_Context()
appears to have changed.  In 2000i Dll_Context() would be called
prior to calling into my DLL for *each* data point.

In TS7 it doesn't appear that Dll_Context() is ever called.  This
means that if you have more than one indicator, etc. using the DLL,
the DLL won't be able to distinguish between them.

Looking at the TS7 EasyLanguage Extension SDK I see that TradeStation
Technologies appears to have deprecated the Dll_{Add,Context,Free}()
constructs and replaced them with a model built on 'events'.

At first review this might be a good thing.  With the ability to get
an IEasyLanguageObject when a DLL function is called one can get the
Open, High, Low, Close, etc. w/o requiring the user to pass this in
as part of the function call.

It seems to me though that to support *legacy* DLLs that TT should
have continued to support the Dll_Context(), yes?

I've modified my DLL and EL code to support v7s changes and I'm able
to get around the Dll_Context() problem - I can differentiate between
two or more uses of my DLL.  My soln to the stranded orchart.exe is
to kill the process by hand.

3. When using the IEasyLanguageObject * form of a DLL export, it
doesn't appear that you can use a passed in float * to return a value
e.g.

In 2000i if you had a function which returned a value like so:

int __stdcall
   MyFunc(float *p_fResult)
{
    *p_fResult = <something>;
}

this won't work:
int __stdcall
   MyFunc(IEasyLanguageObject *p_pEL, float *p_fResult);
{
    *p_fResult = <something>;
}

Instead I needed to do this:
int __stdcall
   MyFunc(IEasyLanguageObject *p_pEL, const char *p_pszVarName);
{
    if (p_pEL)
    {
        p_pEL->Variables[p_pszVarName]->Value[0] = <something>;
    }
    else
    {
        // Error
    } /* end if-else */
}


Cheers,
Brendan
---
Brendan B. Boerner
brendan@xxxxxxxxxxxxxx
Karakhorum Ventures, Inc.
www.Karakhorum.com