Login Page - Create Account

Support Board


Date/Time: Sun, 22 Dec 2024 13:15:50 +0000



[User Discussion] - Different values in SC and VS during debugging

View Count: 1147

[2015-04-18 21:36:53]
zaza.pups - Posts: 3
I write simple dll with shared memory for one integer variable for testing calls functions from external dll from ASCIL dll and try to debug my ASCIL study with Visual Studio. I have differetn values in SC and VS. Can anyone help with this?
Date Time Of Last Edit: 2015-04-18 21:44:01
attachmentSC_External_Calls_Test.cpp - Attached On 2015-04-18 21:32:51 UTC - Size: 1.41 KB - 476 views
attachmentM_GV_d.cpp - Attached On 2015-04-18 21:34:00 UTC - Size: 394 B - 425 views
attachmentSharedDataSegment.h - Attached On 2015-04-18 21:34:21 UTC - Size: 184 B - 473 views
imageww.jpg / V - Attached On 2015-04-18 21:34:54 UTC - Size: 256.48 KB - 459 views
images.jpg / V - Attached On 2015-04-18 21:43:55 UTC - Size: 87.02 KB - 394 views
[2015-04-19 05:44:38]
ejtrader - Posts: 688
it appears like - result doesn't seem to be 1 anytime when called from scdll.

can you try to comment this line and see if the value is even being picked up atleast?

//  if(result == 1)

Date Time Of Last Edit: 2015-04-19 05:44:50
[2015-04-19 12:07:28]
zaza.pups - Posts: 3
Thanks for your feedback, ejtrader, you are right.
The reason for the debugging is that I had messages in a log "This Custom DLL study may cause Sierra Chart to be unstable until you remove the study from your chart and restart Sierra Chart."
Any dll, from wich one would like to call some functhion, should be plased to the SC Data folder, not system32 or another.


[2015-04-19 15:02:07]
ejtrader - Posts: 688
zaza - Here is a sample code you can use for this.


typedef int (__cdecl *SETINT)(int);
typedef int (__cdecl *GETINT)(void);

HINSTANCE hinstLib = LoadLibrary(TEXT("F:\\temp\\M_GV_d.dll"));

SETINT SetInt = (SETINT) GetProcAddress(hinstLib, "GV_SetInteger");
GETINT GetInt = (GETINT) GetProcAddress(hinstLib, "GV_GetInteger");

SCSFExport scsf_ExternalCallTest(SCStudyInterfaceRef sc)
{
SCSubgraphRef Volume = sc.Subgraph[0];

if (sc.SetDefaults) {
sc.GraphName = "ExternalCallTest";
sc.StudyDescription = "ExternalCallTest.";
sc.AutoLoop = 1;

Volume.Name = "Volume from Dll";
Volume.DrawStyle = DRAWSTYLE_BAR;
Volume.LineWidth = 2;
Volume.PrimaryColor = RGB(0, 255, 0);
sc.FreeDLL = FREEDLL;

return;
}

if (sc.LastCallToFunction) {
FreeLibrary(hinstLib);
return;
}

SetInt((int)sc.Volume[sc.Index]);
Volume[sc.Index] = GetInt();

return;
}

http://www.sierrachart.com/image.php?l=1429469107752.png

Date Time Of Last Edit: 2015-04-19 19:16:47
[2015-04-19 19:27:09]
zaza.pups - Posts: 3
Thank you, now I have no problems, but can't understand why sometimes studies couse "This Custom DLL study may cause Sierra Chart to be unstable until you remove the study from your chart and restart Sierra Chart." reaction of Sierra.
I attach my project, works good.
attachmentf.7z - Attached On 2015-04-19 19:27:04 UTC - Size: 1.51 MB - 414 views
[2015-04-19 19:29:03]
ejtrader - Posts: 688
try to use sc.FreeDLL = 0 and see if you still experience the custom dll issue.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account