About string type (link)
The string type is used for storing text strings. A text string is a sequence of characters in the Unicode format with the final zero at the end of it.A string constant can be assigned to a string variable. A string constant is a sequence of Unicode characters enclosed in double quotes: "This is a string constant".
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
dll file ================================
library TestDll;
uses
ShareMem, SysUtils, Classes;
function TestDll_A(i: integer): integer; stdcall;
begin
Result := i * 100;
end;
function TestDll_B(aStr: PChar): integer; stdcall;
begin
// StrCopy(aStr, PChar('123'));
StrCopy(aStr, PChar('in dll in dll'));
Result := 0;
end;
exports
TestDll_A, TestDLL_B;
{$R *.res}
begin
end.
mt5 file ================================
//+------------------------------------------------------------------+
//| TestDll.mq5 |
//| Copyright 2010, MetaQuotes Software Corp. |
//| http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "2010, MetaQuotes Software Corp."
#property link "http://www.mql5.com"
#property version "1.00"
#import "TestDll.dll"
int TestDll_A(int i);
int TestDll_B(string &aStr);
#import
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
string te = "MQL5 string MQL5 string";
Print("123456789");
Print(TestDll_A(30));
Print("123456789");
TestDll_B(te);
Print(te);
Print("123456789");
//---
return(0);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
=============================================
When I was in borland Delphi to call this DLL, can show normal, when I MT5 were called, only showed non-normal character.
How can I do? Thanks!