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

trying again to write dll for ts6



PureBytes Links

Trading Reference Links

I'm attempting to write an external to interface with other software. I
have created a test case for the communication between TS6 and the dll.  I
have been unable so far to get this dll interface to work. Would you please
look at the code and tell me what is missing.

Mike

-------------- C code -----------------

#include <windows.h>
#include <time.h>
#include <stdio.h>
#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif
	void __declspec(dllexport) CCHISTADDCHAIN(int group, int id, int timeinterval);
#ifdef __cplusplus
}
#endif

void __declspec(dllexport) CCHISTADDCHAIN(int group, int id, int timeinterval)
{
	FILE *fp = fopen("c:\\temp\\cctest1", "a");
	time_t tm;
	(void) time(&tm);
	(void) fprintf(fp, "%s received g=%d i=%d t=%d\n", group, id, timeinterval);
	(void) fclose(fp);
}
----------------------------------------

-------------- EL Indicator ------------
Inputs: price(c), group(1), indid(1);

DefineDLLFunc: "c:\tmp\charthistory.dll", VOID, "CCHISTADDCHAIN", int, int, int;

if currentbar = 1 then begin
	CCHistAddChain(group, indid, BarInterval);
end;
plot1(price);
----------------------------------------

The error I receive from TS6 when this indicator is turned on is:
The instruction at "0x03764e3c" referenced memory at "0x00000001". The
memory could not be "read".