Access from MQ4/5 a dll function with: variable-argument lists

 
hi,

Anyone knows if this is possible: to import an dll function which uses as argument a: variable-argument lists

e.g. http://www.cplusplus.com/reference/clibrary/cstdio/vprintf/

int vprintf ( const char * format, va_list arg );

if so how would one do it?

Thanks

MJ
vprintf - C++ Reference
  • www.cplusplus.com
Writes the C string pointed by format to the standard output (stdout), replacing any format specifier in the same way as printf does, but using the elements in the variable argument list identified by arg instead of additional function arguments. Internally, the function retrieves arguments from the list identified by arg as if va_arg was...
 

dll-functions cannot get variable arguments list because of ambiguity.

You can organize yourself parameters array of structures 

 

Slawa, you are wrong you can define a function with list var, for example:


extern "C" __declspec(dllexport) int __stdcall Print(const wchar_t* format , ...)

  {

  va_list argptr;
  va_start(argptr, format);
  int ret = printf(format, argptr);
  va_end(argptr);
  return(ret);

  }

the prom is how can define this function in MT4:

your.mq4

#property strict

#import "TestDLL.dll"

int Print(int file, string format , ...); // NOT ACCEPTED BY THE MT4 COMPILER

#import


But there must be some way to define because the mt4 uses this type of parameters in functions such as Print, Comment or Alert.


_wfopen - MSDN Search
  • social.msdn.microsoft.com
The fopen function opens the file that is specified by filename. _wfopen is a wide-character version of fopen; the arguments to _wfopen are wide-character strings. Otherwise, _wfopen and fopen behave identically. Just using _wfopen has no effect on the coded character set that is used in the file stream. Can’t find it? Here are some options...
 
Francisco Segui:

Slawa, you are wrong you can define a function with list var, for example:


extern "C" __declspec(dllexport) int __stdcall Print(const wchar_t* format , ...)

  {

  va_list argptr;
  va_start(argptr, format);
  int ret = printf(format, argptr);
  va_end(argptr);
  return(ret);

  }

the prom is how can define this function in MT4:

your.mq4

#property strict

#import "TestDLL.dll"

int Print(int file, string format , ...); // NOT ACCEPTED BY THE MT4 COMPILER

#import


But there must be some way to define because the mt4 uses this type of parameters in functions such as Print, Comment or Alert.


Don't say someone he is wrong when you don't understand his answer.

What you are tring to do is NOT POSSIBLE with mql4/mql5.

Reason: