MC 6.1 (3605) IEasyLanguageObject reference Show Stopper

Questions about MultiCharts and user contributed studies.
misterbear
Posts: 4
Joined: 26 Sep 2010

MC 6.1 (3605) IEasyLanguageObject reference Show Stopper

Postby misterbear » 26 Sep 2010

In my C++ DLL the following standard TS SDK call is failing to return a pointer to the IEasyLanguageVariable *pVar and instead raises a "bad parameter" error in MC. See code below. I am doing a port of my EasyLanguage code which uses a C++ DLL. The code has been running well for over a year on TS 8.3 thru TS 8.7 The compiler is VisualStudio 2010 Pro

This failure is a show stopper!!! I need a workaround or a patch. Kindly confirm this functionality is supported or not in MC 6.1

Easylanguage snippet simplified. Note: the builtin variable "value9" is defined thus:

Code: Select all

...
external: "c:\mystuff.dll", void, "mycalc", IEasyLanguageObject, double ;
...
value9 = 0.0 ;
...
mycalc( self, 987.654321 ) ;
...
// --------end of EL code ---------
Example of Easylanguage SDK call failure using Multicharts 6.1 (build 3605)

The following C++ statement fails to return a pointer to a user defined easylanguage variable and instead raises a "bad parameter error"

Code: Select all

...
IEasyLanguageVariable *p = pEL->Variables[ "value9" ] ; // this statement fails
...
For reference this is an excerpt of the failing C++ code

Code: Select all

--------------------------------------------------------
#import "c:\Program Files\TS Support\MultiCharts\PLKit.dll" no_namespace
...
void __stdcall mycalc( IEasyLanguageObject *pEL, double newprice )
{
//this statement immediately fails and raises "bad parameter exception" in MC
IEasyLanguageVariable *pVar = pEL->Variables["value9"] ; // Fails!

//execution never gets here
if ( p )
pVar->AsDouble[0] = newprice ;
}

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: MC 6.1 (3605) IEasyLanguageObject reference Show Stopper

Postby Dave Masalov » 27 Sep 2010

Dear misterbear,

Everything works normally. Please find attached the C++ Dll with the source code and a .pla archive with the example of the script as well as a screenshot.
Attachments
PLKit_Test.zip
(134.44 KiB) Downloaded 150 times

misterbear
Posts: 4
Joined: 26 Sep 2010

Re: MC 6.1 (3605) IEasyLanguageObject reference Show Stopper

Postby misterbear » 27 Sep 2010

Thanks for the confirming example. Much appreciated

misterbear
Posts: 4
Joined: 26 Sep 2010

Re: MC 6.1 (3605) IEasyLanguageObject reference Show Stopper

Postby misterbear » 27 Sep 2010

I have narrowed down the problem further. If i attempt to pass in BarNumber as an argument to the DLL function, I get the runtime parameter error. It does not seem to matter if the arg is type int or double. Passing BarNumber as an arg works in TS but not in MC.

Code: Select all

//======= EL Code =======
external: "c:\mcdll.dll", void, "mycalc", IEasyLanguageObject, string, int ;
value9 = 0.0 ;
mycalc( self, "value9", BarNumber ) ;
Plot1(value9);
It also seems to fail when I indirectly set the BarNumber into a user variable, thus:

Code: Select all

Var: int my_barnum(0) ;
my_barnum = BarNumber ;
...
mycalc( self, "value9", my_barnum ) ;
...
======== C++ DLL function =======

Code: Select all

void __stdcall mycalc( IEasyLanguageObject* pEL, LPCSTR varName, int barnum )
{
IEasyLanguageVariable *pVar = pEL->Variables[ varName ] ;
if ( pVar )
pVar->AsDouble[0] = (double) barnum ;
}

User avatar
Dave Masalov
Posts: 1712
Joined: 16 Apr 2010
Has thanked: 51 times
Been thanked: 489 times

Re: MC 6.1 (3605) IEasyLanguageObject reference Show Stopper

Postby Dave Masalov » 29 Sep 2010

Dear misterbear,

The engineers have confirmed that it is a bug. It has been added to the fix list.

However, there is a workaround. Make the variable series type, if there are series functions calls. For example:

external: "c:\mcdll.dll", void, "mycalc", IEasyLanguageObject, string, double ;
value9 = 0.0 ;
value1 = value9[1]; // make value9 serial variable
mycalc( self, "value9", BarNumber ) ;
Plot1(value9);


Return to “MultiCharts”