PureBytes Links
Trading Reference Links
|
i am having some trouble passing strings from EL study into
powerbasic dll.
- as per EL toolkit as a default strings are passed as
LPSTR C++ , a pointer to a string, that is a pointer is passed
instead of the string itself?
please someone clarify...
- someone mentioned that you can not access string vars
by pointing to those from a dll and you have to make a local copy of
the string to manipulate it?
please someone clarify...
so i wrote a little test dll function in VB called PassString that
is called from EL on the lastbaronchart like this.
vars: ticker ( "" ),
return ( 0 );
DefineDllfunc: "c:\$tsdll\$prolib.dll", int, "PassString", lpstr;
if lastbaronchart then begin
ticker = getsymbolname;
return = PassString ( ticker );
{ i assume here that a pointer to ticker string is passed ??? as
per el toolkit note about passing strings saying that all pointers
are 32 bit ( 4 byte LONG ) }
end;
and the following Powerbasic DLL test function:
#Compile Dll
#Include "WIN32API.INC"
Option Explicit
'mystring is the pointer to MyString?
Function PassString ( ByVal MyString As String Ptr) Export As Integer
' i assume here that value passed is a 32 bit pointer to a string so i
declare it as pointer to a string
Dim CopyOfMyString As String
'get target at MyString pointer
CopyOfMyString = @MyString
MsgBox CopyOfMyString,,"MyString"
PassString = 1
End Function
the end result:
if i declare Function PassString ( ByVal MyString As String Ptr) Export As
Integer
as String pointer tradestaion crashes.
if declare it as Function PassString ( ByVal MyString As Long Ptr) Export
As Integer
as Long Ptr
i get a number ( possibly a pointer ) and not a
string... in the message box when i do CopyOfMyString = str$( @MyString,
0 )
my logic tells me that the message box should display the string passed
which is whatever ticker is loaded into the chart.
i would appreciate if someone could correct the problem for me.
OR
could someone please provide a simple example of how to pass strings
into a dll and back into EL study ( C++ EL tool kit ) in powerbasic or VB...
i am no C++ expert and have trouble connecting the two in terms of passing
string vars.
thank you.
bilo.
|