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

Re: Dlls and tradestation



PureBytes Links

Trading Reference Links

On Wed, 20 Nov 2002, Mark Smeets wrote:

> Hello,
> 
> I'm new to this list, so allow me to introduce myself. My name is Mark
> Smeets and I'm interested in developing trading systems. Up until now
> I've always used my own software, but for various reasons (mostly about
> standardization) I've switched to tradestation. I wanted to port some
> systems developed on my own software to tradestation but quickly came to
> the conclusion that easylanguage itself wouldn't be enough for certain
> computation intensive functions. Programming this functionality in a DLL
> would probably solve that problem. There the trouble started. I'm used
> to unix development and quickly discovered that there are some subtle
> differences when developing for the windows platform. Even more so for
> Tradestation. So, I have a question about developing dlls for ts2000i.
> 
> Using Borland C++ builder 5, I've made a very small dll that contains
> nothing more than a function returning a constant. Nothing fancy, and I
> have no problem linking the dll in a small test application. However,
> when I call this dll from tradestation, I get an "Unable to open FROT"
> error message (where frot is the function I'm calling).
> 
> The el code for the easylanguage function dlltest looks something like
> 
> DefineDLLFunc: "SIMPLE.DLL", LPLONG, "frot"; 
> dlltest = frot();
> 
> The DLL is placed in C:\program files\Omega Research\Program, so that
> should be ok.
> 
> Furthermore, the C++ code looks like:
> 
> #include <windows.h>
> #include <elkit32.h>
> int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*
> lpReserved)
> {
>         return 1;
> }
> LPLONG __export frot()
> {
>   return 300;
> } 
> 
> The elkitbor.lib file was added to the project. After building, I used a
> impdef to create a DEF file. Maybe it is useful to discover what I am
> doing wrong. Here it is:
> 
> LIBRARY     SIMPLE.DLL
> 
> EXPORTS
>     @frot$qv                       @1   ; frot()
>     ___CPPdebugHook                @3   ; ___CPPdebugHook
> 
> 
> What am I doing wrong? The developers kit documentation mentions that it
> is not sufficient to just _export the functions. But what is? 
> 
> Any help will be appreciated.
> 
> Regards,
> 
> Mark Smeets.
> 
> 

You need to create your own def file and give the called function a name
in all CAPS. Use the windows exporting keywords. In vc5.0 I have functions
that begin

__declspec(dllexport) int __stdcall FROT(void)
{
	return 1;
}

Make sure you put the dll someplace where tradestation can find it. I
use c:\temp and in the EL I put

DefineDLLFunc: "c:\temp\mydll.dll", LONG, "FROT";

In the window parlance LPLONG means you're returning a pointer to a long.
I try to use no pointers at all with TSX. For me it causes problems.

Mike