[Advanced Topic] EasyLanguage Extension SDK

Questions about MultiCharts and user contributed studies.
User avatar
danilo
Posts: 170
Joined: 02 Jan 2007
Location: Italy
Has thanked: 4 times
Been thanked: 9 times

[Advanced Topic] EasyLanguage Extension SDK

Postby danilo » 08 Feb 2008

I'm using the latest beta. I have built a simple project (included) and then I have imported the custom function as follow:

--------------------------------------------------------------------------
EXTERNAL: "TestDLL.dll", float, "fl_GetXaverage", float, float, float;

Inputs: price(NumericSimple), lastp(NumericSimple), length(NumericSimple);
Vars: avg(0);

avg = fl_GetXaverage(price, lastp, length);

fGetXaverage = avg;
--------------------------------------------------------------------------
and the built the following indicator:

inputs: Price( Close ), Length( 9 );
variables: AvgExp( 0 ), p0(0), p1(0);

p0 = Price;
p1 = Price[1];

AvgExp = fGetXaverage(p0, p1, Length);

Plot1[Displace]( AvgExp, "AvgExp" ) ;

But the indicator crash ! could you help me to solve the problem ?
Attachments
TestSDK.zip
(16.99 KiB) Downloaded 185 times

User avatar
Marina Pashkova
Posts: 2758
Joined: 27 Jul 2007

Postby Marina Pashkova » 14 Feb 2008

Dear Marina,

We are near to release 3.0 of MC and I'd like to have an official answer to SDK support in MC. Is the EasyLanguage extension SDK supported in MC ? and if not when will be supported ?

Best Regards
Dear danilo,

Both EasyLanguage extension SDK and the SDK for TS2000i are supported in MultiCharts.

User avatar
danilo
Posts: 170
Joined: 02 Jan 2007
Location: Italy
Has thanked: 4 times
Been thanked: 9 times

Postby danilo » 14 Feb 2008

Dear Marina,

I have problems to run even the simplest sample that i have already posted, the message that is showed by MC (latest beta) is:

--------------------------------------------------------------------------------
<<EXCEPTION>>
Address: 0x6C041405 ( 1812206597 )
Code: 0xC0000005 ( -1073741819 )
Continuable: 0x00000000 ( 0 )
Description: L'istruzione a "0x
ErrorCode: 0xC0000005 ( -1073741819 )
ExceptionType: 0x00000000 ( 0 )
Module: D:\Documents and Settings\All Users\Dati applicazioni\TS Support\MultiCharts\StudyServer\Studies\Dlls\Functions\f_fgetxaverage.dll
Process: C:\Programmi\TS Support\MultiCharts\MultiCharts.exe
Thread ID: 0x000005FC ( 1532 )
Time: 14.02.2008 - 21:03:18.671
--------------------------------------------------------------------------------
please, could you check what's wrong in the sample that I have sent or POST a simple but complete WORKING sample ?

Regards,
Danilo

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 15 Feb 2008

EasyLanguage_Reference_Guide.pdf (174 page of 292)
==================================================

Defining a DLL Function
_______________________

Before you can call a DLL function from EasyLanguage, you must declare the DLL using
a DLL Function Declaration statement.
Syntax:
DefineDLLFunc: “DLLNAME.DLL”, Return Type, “FunctionName”,Parameters ;

DLLNAME.DLL is the name of the DLL where the function resides, Return Type is the type
of expression the function will return,
FunctionName is the name of the function as defined in the DLL,
and Parameters is the list of parameters expected by the function (each parameter separated by a comma).

It is very important to remember that 32-bit DLLs use case-sensitive exported functions declared
using _cdecl, _ _stdcall , or fastcall.
For DLLs to be compatible with EasyLanguage,
exported functions should be created using all uppercase letters and be declared as _stdcall.
These exported functions must be listed within the EXPORTS section of the DLL’s .DEF
file. Using “_declspec (dllexport)” from the function’s prototype is not sufficient for
EasyLanguage to locate a DLL’s exported functions.

-----
You should define functions as _stdcall and add them in .DEF

-----
If you use it this way it will work fine. We’ve tested.

float __stdcall fl_GetXaverage(float Price, float lastX, float length);

LIBRARY "TestDLL"
EXPORTS
fl_GetXaverage @1
----

User avatar
danilo
Posts: 170
Joined: 02 Jan 2007
Location: Italy
Has thanked: 4 times
Been thanked: 9 times

Postby danilo » 15 Feb 2008

Now is working ! the *.DEF file is mandatory to have the dll working in MC, the dllexport is not compatible (add an underscore before the name) with MC.

Many Thanks for the Help.

cael
Posts: 89
Joined: 06 Sep 2006
Has thanked: 2 times

Postby cael » 15 Feb 2008

Is it possible to link MC with Visual Basic .Net?
I really can't do this DLL stuff.

User avatar
Andrew Kirillov
Posts: 1589
Joined: 28 Jul 2005
Has thanked: 2 times
Been thanked: 31 times
Contact:

Postby Andrew Kirillov » 16 Feb 2008

DEF is not mandatory. It just simplifies the task. You can do the same using dllexport. We don’t use VB.net so you need to see how to export functions there. It is definitely possible, we just don’t use it.


Return to “MultiCharts”