How to remove Kernel32.dll from expert code

 

Hi Dears,

I want to upload an EA on mql5 but this EA needs Kernel32.dll to run and mql5 don't allow EA dll necessary uploading.

How can I delete this dll from my EA code?

This part of code that use this dll is below code:

#import   "kernel32.dll"
int CreateFileW(string Filename,int AccessMode,int ShareMode,int PassAsZero,int CreationMode,int FlagsAndAttributes,int AlsoPassAsZero);
int GetFileSize(int FileHandle,int PassAsZero);
int SetFilePointer(int FileHandle,int Distance,int &PassAsZero[],int FromPosition);
int ReadFile(int FileHandle,uchar &BufferPtr[],int BufferLength,int  &BytesRead[],int PassAsZero);
int CloseHandle(int FileHandle);
 
Mohammad Hasan Mosaddeqi: This part of code that use this dll is below code:

That part of the code is not using a DLL. It is just declaring that it will call those functions. Just delete the section.

 
William Roeder #:

That part of the code is not using a DLL. It is just declaring that it will call those functions. Just delete the section.

but when I remove the below row,

#import   "kernel32.dll"

and compile, I receive  some errors (below screenshot)

errors

and these functions shown in error bar are related to kernel32.dll.

How can I solve this issue?


Regards

 
Mohammad Hasan Mosaddeqi #: but when I remove the below row, and compile, I receive  some errors (below screenshot) and these functions shown in error bar are related to kernel32.dll. How can I solve this issue?

You will have to rewrite those sections of the code so that they don't depend on the Windows API, either by using internal MQL functions instead, or removing that logic completely. That needs to be done by an experienced coder.

 
Mohammad Hasan Mosaddeqi: I want to upload an EA on mql5 but this EA needs Kernel32.dll to run and mql5 don't allow EA dll necessary uploading. How can I delete this dll from my EA code? This part of code that use this dll is below code:

You need make library file, and write all fuctions, example you have library mylib.ex4, on code EA #import  "mylib.ex4", so EA will call fuction from  mylib.ex4, not from kernel32.dll.

Then you can upload EA on mql5 Market

This post was edited by moderator.

⚠️ This suggestion would violate the Market rules. Please, don't attempt it, or you may end up being banned from the Market or lose your "seller" status.

 
Trinh Dat #:

You need make library file, and write all fuctions, example you have library mylib.ex4, on code EA #import  "mylib.ex4", so EA will call fuction from  mylib.ex4, not from kernel32.dll.

Then you can upload EA on mql5 Market

write what fuctions do you write

 
@Christopher David Ayotte #: write what fuctions do you write

Please disregard the post you quoted. The user is suggesting you "hide" the DLL calls in a separate library file that you would need to supply separately from the Market product.

That however, violates the Market rules — it would "limit" the EA (a rule violation) and make it dependant on an external functionality (also a violation).