[Advanced Topic] Programming DLL

Read before posting.
User avatar
TJ
Posts: 7231
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 991 times
Been thanked: 2056 times

[Advanced Topic] Programming DLL

Postby TJ » 30 Mar 2011

TS EasyLanguage Extension Software Development Kit (SDK)
provides users with the ability to write code in a programming language that allows for the creation of DLLs (for example, C++, Pascal, Delphi, or Visual Basic) and call that code from within an EasyLanguage analysis technique.

https://www.multicharts.com/trading-sof ... on_Sources




see also:
[Advanced Topic] MultiCharts 64 bit Resources
viewtopic.php?f=16&t=10094


PS. If you search using the keywords [Advanced Topic] or DLL, you will find additional useful posts
eg. search.php?keywords=dll&terms=all&autho ... ulticharts



-------------------------------------------------------
Has this post been helpful to you?

power

[Advanced Topic] MultiCharts -- Programming DLL

Postby power » 21 Apr 2011

Hi,

Is MultiCharts has a sdk to develop using C#. I want to use Visual Studio and build .dll files than import to MultiCharts. Is there a mechanism like that in Wealth-Lab.

User avatar
Stan Bokov
Posts: 963
Joined: 18 Dec 2009
Has thanked: 367 times
Been thanked: 302 times

Re: MultiCharts using C#

Postby Stan Bokov » 21 Apr 2011

MultiCharts can use external DLL files from PowerLanguage script. You can use the following keywords to access external DLLs:

external method: "myfile.dll"

However, keep in mind that PLE is available only the regular version of MultiCharts.

arjfca
Posts: 1283
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Re: MultiCharts using C#

Postby arjfca » 29 Feb 2012

MultiCharts can use external DLL files from PowerLanguage script. You can use the following keywords to access external DLLs:

external method: "myfile.dll"

However, keep in mind that PLE is available only the regular version of MultiCharts.
Stan,

Under witch directory does the dll file need to reside? I got problem to access special dll functions

Martin

User avatar
Henry MultiСharts
Posts: 9132
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2929 times

Re: MultiCharts using C#

Postby Henry MultiСharts » 01 Mar 2012

Hello Martin,

If you do not specify the path to the dll then the script will search for it in the MultiCharts folder

32 bit: C:\Program Files (x86)\TS Support\MultiCharts
64 bit: C:\Program Files\TS Support\MultiCharts64

If you specify the path to the dll then the script will search for it in the specified folder.

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1503 times
Contact:

Re: MultiCharts using C#

Postby JoshM » 01 Mar 2012

Is MultiCharts has a sdk to develop using C#.
MultiCharts can use external DLL files from PowerLanguage script.
If I'm not mistaken, MultiCharts can not work with C# DLL's? (C++ works, and the EL and ADE are also written in this if I recall correctly)

I'm wondering because I could not make C# DLL's to work with MultiCharts, and was advised by support to use C++ code for what I was trying to achieve.

I know more C# than C++, hence my question. :)

User avatar
Henry MultiСharts
Posts: 9132
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2929 times

Re: MultiCharts using C#

Postby Henry MultiСharts » 02 Mar 2012

You can make C# DLLs to work in MultiCharts.
You can find more information regarding the subject in
TS EasyLanguage Extension Software Development Kit.

You can also submit a feature request to the Project Management: "use .NET assemblies from PowerLanguage" with detailed explanation how do you want to use it.

trader39
Posts: 101
Joined: 08 Jan 2006
Has thanked: 8 times
Been thanked: 5 times

Writing DLLs for MC64

Postby trader39 » 05 Mar 2012

https://developer.TS.com/docu ... on_SDK.pdf

indicates that tskit.dll should be imported to write dlls. However that is a 32 bit dll, which presumably is incompatible with MC64. Do you have a tskit.dll substitute for writing 64 bit dlls, or alternatively, suggestions on how to write DLLs without tskit?

User avatar
Henry MultiСharts
Posts: 9132
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2929 times

Re: Writing DLLs for MC64

Postby Henry MultiСharts » 06 Mar 2012

Hello Trader39,

You need to use PLkit.dll to write 64 bit DLLs.
This dll can be found in MultiCharts folder.




moderator's note:
[Advanced Topic] MultiCharts 64 bit Resources
viewtopic.php?f=16&t=10094

trader39
Posts: 101
Joined: 08 Jan 2006
Has thanked: 8 times
Been thanked: 5 times

Re: Writing DLLs for MC64

Postby trader39 » 06 Mar 2012

Great.

What (preferably free and available online) compiler (Java or C or C++) would you recommend to write MC64 compatible dlls? I presume a 64 bit compiler is required, but I note that cc1plus.exe *32 (presumably 32 bit?) is active in the task manager when MC64 power language scripts are compiled.

trader39
Posts: 101
Joined: 08 Jan 2006
Has thanked: 8 times
Been thanked: 5 times

Re: Writing DLLs for MC64

Postby trader39 » 06 Mar 2012

I note that Visual Studio 2010 is available for free 30 day trial download so that would be an option, if you recommend it, although it does not seem to support Java. (Please advise whether to run it in 32 or 64 bit mode if you do recommend it).

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

Re: Writing DLLs for MC64

Postby Dave Masalov » 12 Mar 2012

Hi
VS DLL are not compatible with MC.
Emmanuel
VS DLL are compatible with MultiCharts. Please use Microsoft Visual Studio 2008 or 2010 C++

For MC 64 bit compile dll for x64 platform.
For MC 32 bit compile dll for Win32 platform.

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

Re: Writing DLLs for MC64

Postby Dave Masalov » 12 Mar 2012

What (preferably free and available online) compiler (Java or C or C++) would you recommend to write MC64 compatible dlls? I presume a 64 bit compiler is required, but I note that cc1plus.exe *32 (presumably 32 bit?) is active in the task manager when MC64 power language scripts are compiled.
So what compiler do you recommend?
Basically, you can use any software that you are familiar with as long as it compiles Win32 and x64 dlls.

See more discussions here:
viewtopic.php?f=1&t=8391&p=39052&hilit=DLLS#p39052

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1503 times
Contact:

Re: MultiCharts using C#

Postby JoshM » 22 Jun 2012

You can make C# DLLs to work in MultiCharts. You can find more information regarding the subject in TS EasyLanguage Extension Software Development Kit.
Can you explain how to make a C# dll? I've followed the EasyLanguage Extension SDK to the letter, but run into problems with step 1: importation of tskit.dll (which I don't have). If I add the elkit32.dll from the MultiCharts program folder as a reference to the Visual Studio DLL, I get the
Could not load file or assembly 'elkit32.dll' or one of it dependencies. The module was expected to contain an assembly manifest.

This file may not be a managed assembly.
error message. If I try to import it as an unmanaged assembly (through DLLImport), I don't know how to make the accompanying method/entry point, since well, I can't look into that DLL for the correct method name.

If I go ahead and make the DLL without the elkit32.dll reference, I get the "can't find function .. in dll" error message when adding the indicator.

So to summarize; does someone has a working C# project (that can be reverse engineered to learn how it works), or willing/able to write down the needed steps? :)

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: MultiCharts using C#

Postby Dru » 27 Jun 2012

So to summarize; does someone has a working C# project (that can be reverse engineered to learn how it works), or willing/able to write down the needed steps? :)
The question like "How I can use .NET assembly in MultiCharts (PL)" is same as question "How I can use .NET assembly in any unmanaged application". There are many ways exists.

PL code for example:

Code: Select all

EXTERNAL: "net_assembly_interop.dll", double, "Summ", double, double;
if close + open <> Summ(close, open) then raiseruntimeerror(":-(");
You do not have the required permissions to view the files attached to this post.

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1503 times
Contact:

Re: MultiCharts using C#

Postby JoshM » 27 Jun 2012

Thanks Dru for your example! :)

If you allow me another newbie question, can you (or someone else) tell how to use this generated DLL in MultiCharts from the VS project? Here's what I've done:

1) Opened the project file Call_dotNET_code_from_PL in Visual Studio,
2) Visual Studio converted both projects to VS10 project format,
3) Hit F6 to build solution,
4) Copied the net_assembly_interop.dll file from '\Call_dotNET_code_from_PL\Debug\' to 'C:\Program Files\MultiCharts\'.
5) Added the following PowerLanguage code in an empty indicator:

Code: Select all

EXTERNAL: "net_assembly_interop.dll", double, "Summ", double, double;

if (LastBarOnChart_s = True) then begin

Print("10 + 231.2 = ", Summ(10, 231.2));

end;
6) Got an application error after adding the indicator to the chart.
Image

If I use the net_assembly.dll, I get the "Can't find function 'Summ' in dll." error message.
You do not have the required permissions to view the files attached to this post.

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: MultiCharts using C#

Postby Dru » 28 Jun 2012

4) Copied the net_assembly_interop.dll file from '\Call_dotNET_code_from_PL\Debug\' to 'C:\Program Files\MultiCharts\'.
net_assembly_interop.dll is the C++/CLI "mixed" dll (native dll + managed code). i.e. it is PROXY that delegate all work to net_assembly.dll - is the pure managed dll (assembly) that do all job.
You need copy both dll to MC dir
P.S. During build take attention to Solution Configuration and MultiCharts.exe bit depth (x64 vs x86)

alanyangbo
Posts: 3
Joined: 28 Oct 2012
Has thanked: 1 time

Re: MultiCharts using C#

Postby alanyangbo » 28 Oct 2012

4) Copied the net_assembly_interop.dll file from '\Call_dotNET_code_from_PL\Debug\' to 'C:\Program Files\MultiCharts\'.
net_assembly_interop.dll is the C++/CLI "mixed" dll (native dll + managed code). i.e. it is PROXY that delegate all work to net_assembly.dll - is the pure managed dll (assembly) that do all job.
You need copy both dll to MC dir
P.S. During build take attention to Solution Configuration and MultiCharts.exe bit depth (x64 vs x86)
good job! Another question:if c# function return String and its parameters also string,then how to correct write c++ dll?It is big problems for me :( Looking forward to your reply!
Alan.

User avatar
Henry MultiСharts
Posts: 9132
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2929 times

Re: MultiCharts using C#

Postby Henry MultiСharts » 29 Oct 2012

Another question:if c# function return String and its parameters also string,then how to correct write c++ dll?It is big problems for me :( Looking forward to your reply!
Alan.
Here is how you need to define the functions that should receive the strings in C++/CLI dll:

Code: Select all

System::String ^ __clrcall TestString(System::String ^ s1)
Here is how such function should be described in PLE:

Code: Select all

DefineDLLFunc: "net_assembly_interop.dll", string, "TestString", string;

beolee
Posts: 1
Joined: 20 Nov 2012

Re: [Advanced Topic] Programming DLL

Postby beolee » 21 Nov 2012

my c++ source MyDllFile.cpp:

Code: Select all

#import "D:\Prog\TS Support\MultiCharts\tskit.dll" no_namespace
#include <atlbase.h>

//////////////////////////////////////////////////////////////
// Calculate simple moving average value

double __stdcall MovAvg
( IEasyLanguageObject * pELObj, int iAvgLength )
{
double dMovAvg ;
dMovAvg = 0 ;

// verify that sufficient bars have passed before back-referencing historical prices
//if( pELObj->CloseMD[data1]->BarsBack > iAvgLength && iAvgLength > 0 )

{
double dSum = 0.0 ;
for (int i = 0; i < iAvgLength; i++)
{
dSum += pELObj->CloseMD[data1]->AsDouble[ i ] ;
}
dMovAvg = dSum / iAvgLength ;
}
//return dMovAvg ;
return 1.1;
}

//////////////////////////////////////////////////////////////
// Generate a run-time error in TS
// This function is called internally by other DLL functions when an error in TS
// is to be produced.

void fnGenRunTimeError
( IEasyLanguageObject * pEL, int iErrorNum )
{
TSRuntimeErrorItem tsItem;
int m_HistErr ;
tsItem.sCompany = _bstr_t("TS Securities, Inc.").copy();
tsItem.sErrorLocation = _bstr_t("Example Code Library").copy();
tsItem.sErrorCategory = _bstr_t("Error").copy();
tsItem.sLongString = NULL;
tsItem.nParameters = 0;

switch ( iErrorNum )
{
case 1:
{
// Error 1
tsItem.sShortString = _bstr_t("Error – Description of Error 1 goes here.").copy();
tsItem.sSourceString = _bstr_t("Additional detailed description goes here.").copy();
tsItem.nErrorCode = iErrorNum ;
}
break ;
case 2:
{
// Error 2
tsItem.sShortString = _bstr_t("Error – Description of Error 2 goes here.").copy();
tsItem.sSourceString = _bstr_t("Additional detailed description goes here.").copy();
tsItem.nErrorCode = iErrorNum ;
}
break ;
default:
{
// Generate a run-time error of undefined type or origin
tsItem.sShortString = _bstr_t("Undefined error in "
"MyDLL.dll.").copy();
tsItem.sSourceString = _bstr_t("Error origin undefined.").copy();
tsItem.nErrorCode = 9999 ;
}
}

m_HistErr = pEL->Errors->RegisterError( &tsItem ) ;
pEL->Errors->RaiseRuntimeError( m_HistErr ) ;
}


//////////////////////////////////////////////////////////////
// Server field call
double __stdcall GETSERVERFIELD
(IEasyLanguageObject *pEL, LPSTR szFName)
{
// IEasyLanguageServerField *iSF = pEL->ServerField[_bstr_t(szFName)][dataDefault];
// return iSF->AsDouble[0];
return 1.0;
}


//////////////////////////////////////////////////////////////
// Sort an EasyLanguage array using this DLL function

void __stdcall MYARRAYSORT
( IEasyLanguageObject* pELObj, char* MyArrayName )
{
int nOuter, nInner ;
IEasyLanguageVariable* pELVar = pELObj->Variables[ MyArrayName ] ;
if ( pELVar->Dimensions == 1 )
{
int nSize = pELVar->DimensionSize[0] ;
for ( nOuter = 0; nOuter < nSize - 1; nOuter++ )
{
for ( nInner = nOuter + 1; nInner < nSize; nInner++ )
{
pELVar->SelectedIndex[0] = nInner ;
double dSecondValue = pELVar->Value[0] ;
pELVar->SelectedIndex[0] = nOuter ;
double dFirstValue = pELVar->Value[0] ;
if ( dSecondValue < dFirstValue )
{
double dTmp = dFirstValue ;
pELVar->Value[0] = dSecondValue ;
pELVar->SelectedIndex[0] = nInner ;
pELVar->Value[0] = dTmp ;
}
}
}
}
}


//////////////////////////////////////////////////////////////
// Fill dynamic EasyLanguage array

void __stdcall FILLDYNARRAY
(IEasyLanguageObject * pEL, LPSTR PassedVar)
{
IEasyLanguageVariablePtr pMyVar = NULL;
IELFrameworkArrayPtr pDynArray = NULL;

IEasyLanguageDateTime * pMyDateTime = pEL->DateTimeMD[ dataDefault ] ;
double myDT = pMyDateTime->AsDateTime [0] ;

long nTotVars = pEL->VariablesCount;
for (long n = 0; n < nTotVars; n++)
{
pMyVar = pEL->Variables[n];
_bstr_t mybstr = pMyVar->Name;
if (pMyVar->DataType == dtHandle)
{
int nValue = pMyVar->GetAsInteger(0);
CComVariant xx(pEL->Close[0]);
if (pEL->System->Array->IsValidHandle( (int) nValue ) && (mybstr == (_bstr_t) PassedVar))
{
pDynArray = pEL->System->Array;
pDynArray->SetValue(nValue, 0, CComVariant(xx));
}
}
}
}
//////////////////////////////////////////////////////////////
// Sum upticks and downticks from intraday chart to get volume in DLL – store in global DLL variable

double dMyDLLDouble = 0; //global variable

int __stdcall SetdMyDLLDouble
( IEasyLanguageObject * ELObjP )
{
dMyDLLDouble = ELObjP->UpTicksMD[dataDefault]->AsDouble[0]
+ ELObjP->DownTicksMD[dataDefault]->AsDouble[0] ;
return 1;
}
===============================
my pl source :

Code: Select all

external: "MyDllFile.dll", double, "MovAvg", IEasyLanguageObject {self}, int {Length};

inputs:
Length( 10 ) ;

variables:
double MyELVar( 0 ) ;

MyELVar = MovAvg( self, Length ) ;

plot1(MyELVar ,"MyELVar ");
======================================
when I add the indicator to the chart , I got a error message cannot find the "MovAvg" function.

I have copied the MyDllFile.dll into MultiCharts directory.

Can you help me?

User avatar
Henry MultiСharts
Posts: 9132
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2929 times

Re: [Advanced Topic] Programming DLL

Postby Henry MultiСharts » 21 Nov 2012

beolee, the function is not defined as external in your dll.
You need to define it as an external function or create a def file in VS and add this function to it.

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: MultiCharts using C#

Postby Dru » 21 Jan 2013

if c# function return String and its parameters also string,then how to correct write c++ dll?
Example updated.

Code: Select all

EXTERNAL: "net_assembly_interop.dll", lpstr, "ReturnStringExample", lpstr;
plot1( ReturnStringExample("from PL") );
You do not have the required permissions to view the files attached to this post.

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1526 times
Been thanked: 1503 times
Contact:

Re: MultiCharts using C#

Postby JoshM » 25 Jan 2013

if c# function return String and its parameters also string,then how to correct write c++ dll?
Example updated.

Code: Select all

EXTERNAL: "net_assembly_interop.dll", lpstr, "ReturnStringExample", lpstr;
plot1( ReturnStringExample("from PL") );
Dru, can you tell something about how you created the net_assembly_interop C++ dll? That way I can create another DLL with a different name. I know practically nothing about C++, so if it's not to much to ask, can you say, in "Dummy language" which steps you took?

(Edit: Since the PowerLanguage code calls the interop dll, I assume that every C# dll need its own accompanying interop dll, hence the question. Don't know though if this assumption is valid.)

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: MultiCharts using C#

Postby Dru » 26 Feb 2013

Dru, can you tell something about how you created the net_assembly_interop C++ dll?
Hmm ...
Do you want to know how I am writing a program in C++? :)
You can take the example and change project properties for new dll name.
Keywords for studying: C++/CLI, MS VS 2008, export functions from dll

Dru
Posts: 107
Joined: 28 Aug 2007
Has thanked: 4 times
Been thanked: 171 times

Re: MultiCharts using C#

Postby Dru » 26 Feb 2013

Since the PowerLanguage code calls the interop dll, I assume that every C# dll need its own accompanying interop dll, hence the question. Don't know though if this assumption is valid.)
This is not necessary. The ONE interop dll can be the "bridge" for many .NET (C#) assemblies.

csharpstudent
Posts: 4
Joined: 12 Mar 2013
Has thanked: 4 times

Re: [Advanced Topic] Programming DLL

Postby csharpstudent » 12 Mar 2013

Hello all.
I have tried to follow the very helpful responses above on how to build a dll for MC.

I would REEEEALLLY be thankfyl if anyone could help me get the following accomplished:

Objective of the DLL - Send from PowerLanguage code, date and time and read an ASCII file and pass the value back to MC 32 bit.

Format of file

1/1/2012 12:04 565.6
1/1/2012 12:05 675.4

Format is
<dd/mm/yyyy> <hh:mm> <numeric value>

So I would send the date and time into the DLL via PowerLanguage and receive back the value.

I would via this exercise love to learn how to write DLLs to be used, so some clarity on how to integrate it into MC 32 bit (and eventually MC64).

I really look forward to your help.

Best Reagrds

arjfca
Posts: 1283
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Re: [Advanced Topic] Programming DLL

Postby arjfca » 13 Mar 2013

Hello all.
I have tried to follow the very helpful responses above on how to build a dll for MC.

I would REEEEALLLY be thankfyl if anyone could help me get the following accomplished:

Objective of the DLL - Send from PowerLanguage code, date and time and read an ASCII file and pass the value back to MC 32 bit.

Format of file

1/1/2012 12:04 565.6
1/1/2012 12:05 675.4

Format is
<dd/mm/yyyy> <hh:mm> <numeric value>

So I would send the date and time into the DLL via PowerLanguage and receive back the value.

I would via this exercise love to learn how to write DLLs to be used, so some clarity on how to integrate it into MC 32 bit (and eventually MC64).

I really look forward to your help.

Best Reagrds
Not answering your question but,
If I remenber, there is ElCollection.dll that could read/write asci file.

Martin

csharpstudent
Posts: 4
Joined: 12 Mar 2013
Has thanked: 4 times

Re: [Advanced Topic] Programming DLL

Postby csharpstudent » 13 Mar 2013

Martin,
Thanx for the pointer. Where would I find this ElCollection.dll , its docs/usage steps etc.

Best

youn56
Posts: 46
Joined: 29 Mar 2012
Has thanked: 13 times
Been thanked: 6 times

Re: [Advanced Topic] Programming DLL

Postby youn56 » 13 Mar 2013


arjfca
Posts: 1283
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Re: [Advanced Topic] Programming DLL

Postby arjfca » 13 Mar 2013

Martin,
Thanx for the pointer. Where would I find this ElCollection.dll , its docs/usage steps etc.

Best
CsharpStudent. Look on this post from user TJ: viewtopic.php?f=16&t=10094#p48319


Martin :)

eto
Posts: 33
Joined: 09 May 2011
Has thanked: 13 times
Been thanked: 7 times

Re: [Advanced Topic] Programming DLL

Postby eto » 25 Jan 2014

Hi,

I'm sorry. Seems i'm a bit late of discussing about C# dll called in Easylanguage.

Hope someone still can help me because a bit confuse after reading the topic from above. I have downloaded dru's example but doesn't look like in example in TS sample which is using c/c++.

I'm using MC 64 bit. Do i still need to import PLkit.dll in creating C# dll or i do not need to import PLkit.dll ? Appreciate someone explain further details or step by step.

Thanks.

Richardo
Posts: 1
Joined: 21 Oct 2014

Re: [Advanced Topic] Programming DLL

Postby Richardo » 21 Oct 2014

Hi,

Is MultiCharts has a sdk to develop using C#. I want to use Visual Studio and build .dll files than import to MultiCharts. Is there a mechanism like that in Wealth-Lab.

User avatar
Henry MultiСharts
Posts: 9132
Joined: 25 Aug 2011
Has thanked: 1260 times
Been thanked: 2929 times

Re: [Advanced Topic] Programming DLL

Postby Henry MultiСharts » 21 Oct 2014

Hello Richardo,

Please check the Extension Software Development Kit at Additional Information Sources page.

leverman
Posts: 1
Joined: 10 Feb 2016

Re: [Advanced Topic] Programming DLL

Postby leverman » 24 Feb 2016

Hello,

some time passed for this topic and I think the new VS version is causing me problems.

When Multicharts64 uses an indicator that has the external-keyword in order to call a c++ dll I get the “Can’t find Dll “<myDll>.dll””- message. I was able to use predefined .dlls that are shipped with MC64 in the PLEditor (like GlobalVariable.dll). On the other hand when ever I try to add a reference to my VS 2015 Project it says that the library is either not a .net assembly, build in a higher version of .net or is not a registered ActiveX control. It seems that there has been an update to the VS built-in compiler that makes unreadable builds for MC64. My basic goal is to use c# dlls in powerlanguage. Using MC .net is not an option...yet. So what are the specific setups for building for example the GlobalVariable.dll?

I used the code that was provided in this thread by Dru.

User avatar
Smoky
Posts: 413
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 67 times
Been thanked: 105 times

Re: [Advanced Topic] Programming DLL

Postby Smoky » 18 Sep 2018

@ Dru

please can You update our sample "Call_dotNET_code_from_PL.zip" projet , i use VS 17 and i have many errors.

Thanks

andrei
Posts: 20
Joined: 24 Jan 2013
Has thanked: 2 times
Been thanked: 1 time

Re: MultiCharts using C#

Postby andrei » 29 Nov 2018

if c# function return String and its parameters also string,then how to correct write c++ dll?
Example updated.

Code: Select all

EXTERNAL: "net_assembly_interop.dll", lpstr, "ReturnStringExample", lpstr;
plot1( ReturnStringExample("from PL") );
Dru, can you tell something about how you created the net_assembly_interop C++ dll? That way I can create another DLL with a different name. I know practically nothing about C++, so if it's not to much to ask, can you say, in "Dummy language" which steps you took?

(Edit: Since the PowerLanguage code calls the interop dll, I assume that every C# dll need its own accompanying interop dll, hence the question. Don't know though if this assumption is valid.)
do you need to use the same external statement to import GlobalVariable.DLL present in the MC64 install folder?

thx

User avatar
Smoky
Posts: 413
Joined: 03 Dec 2010
Location: Thailand
Has thanked: 67 times
Been thanked: 105 times

Re: [Advanced Topic] Programming DLL

Postby Smoky » 29 Nov 2018

no andrei, GlobalVariables are in standard in MC? You don't have to define functions.
Global Variable 2.2.doc
You do not have the required permissions to view the files attached to this post.

kh_model
Posts: 33
Joined: 13 Jul 2005
Has thanked: 6 times

Re: [Advanced Topic] Programming DLL

Postby kh_model » 11 Dec 2018

When it is stated that PLKit.dll is required to build a dll which works with Multicharts64, should I assume that even a dll which does not make use of any internal MultiCharts or Powerlanguage functions must be built against PLKit.dll if I wish to call it from within PowerLanguage? Using a tool like Depends.exe, I can never seem to find any references to PLKit.dll when I examine existing known 64 bit dlls such as ELTicToc.dll. In fact, I see no references to ELKit.dll or TSKit.dll when I examine with Depends.exe any third party dlls which are known to be 32 bit implementations and which are also known to work with MultiCharts and TS. Does that mean that those dlls were not built against any kind of sdk which relates to TS or Multicharts? I would like to see an old example in C or C++ in which getProcAddress is used to load a third party dll function so that I can have a better idea of how that would be applied to MultiCharts64 without using C# or managed code.


Return to “MultiCharts FAQ”