Forex
Google

Go Back   Forex Trading > Metatrader Training > Metatrader 4 mql 4 - Development course > Questions
Forex Forum Register FAQ Members List Calendar Today's Posts


Register in Forex TSD!
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time).
Click here to register and get more information

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-04-2005, 11:11 PM
TheExponential TheExponential is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
TheExponential is on a distinguished road
#import questions

I'm trying to create a library file (.ex4) file to be used by #import syntax in the main program.

I have a problem in compiling the called library program. when trying to compile it, it complains "Start function not found". What should I do?

Should I also put these library programs in a separate directory?

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-06-2005, 10:08 PM
TheExponential TheExponential is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
TheExponential is on a distinguished road
can anyone help, please!

CodesGuru?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-06-2005, 11:48 PM
codersguru's Avatar
codersguru codersguru is offline
Senior Member
 
Join Date: Oct 2005
Posts: 987
codersguru has a spectacular aura aboutcodersguru has a spectacular aura aboutcodersguru has a spectacular aura about
Arrow Library preprocessor directive

Quote:
Originally Posted by TheExponential
I'm trying to create a library file (.ex4) file to be used by #import syntax in the main program.

I have a problem in compiling the called library program. when trying to compile it, it complains "Start function not found". What should I do?

Should I also put these library programs in a separate directory?

Thanks!
TheExponential,
I'm so sorry for the delay.

The error you have got because (I think) you didn't write this line on the top of your library program:

#property library
To create a library you have to:

1- Use #property library
preprocessor directive on the top of your program (see the example).

2- Compile and save it in "MetaTrader 4\experts\libraries" path.

Example:

PHP Code:
//+------------------------------------------------------------------+
//|                                                     Alerts.mq4 |
//|                                                     Coders Guru |
//|                                         http://www.forex-tsd.com |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//|Use this code at your risk, I don't guarantee anything.         |                                     |
//+------------------------------------------------------------------+
#property copyright "Coders Guru"
#property link      "http://www.forex-tsd.com"
#property library
#include <WinUser32.mqh> //for MessageBoxA

#import "kernal32.dll"


//+------------------------------------------------------------------+
//|This function shows dialog box showing the data you passed        | 
//|Click "Retry if you want to see the messages next time,           | 
//|and click "Cancel" to disable the messages                     |                                     |
//+------------------------------------------------------------------+
void Msg(string message)
{
   
//int MessageBoxA(int hWnd ,string lpText,string lpCaption,int uType);
   
static bool disable false;
   
int result 0;
   
   if(!
disable)
   
result MessageBoxA(NULL,message,"Click cancel to disable Alerts!",MB_RETRYCANCEL|MB_ICONINFORMATION);
   
   if(
result==IDCANCEL)
   
disable=true;  
}

//+------------------------------------------------------------------+
//|This function rerun trus when line1 cross line2                 |
//|and false otherwise                                             | 
//|Ex: Print(Crossed (ExtMapBuffer1[0],ExtMapBuffer2[0]));           | 
//+------------------------------------------------------------------+
bool Crossed (double line1 double line2 )
{

static 
string last_direction "";
string current_dirction "";

if(
line1>line2)current_dirction "up";
if(
line1<=line2)current_dirction "down";



if(
current_dirction != last_direction
{
      
//Alert("EMA Cross for "+Symbol()+" on the "+Period()+" minute chart.");
      
Msg("EMA Cross for "+Symbol()+" on the "+Period()+" minute chart.");
      
last_direction current_dirction;
      return (
true);
}
else
{
      return (
false);

}
 


//+------------------------------------------------------------------+ 



__________________
Hope it helps !
Coders' Guru
Senior MQL programmer:
www.xpworx.com/custom.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-08-2005, 10:45 AM
TheExponential TheExponential is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
TheExponential is on a distinguished road
Thanks once again, CodesGuru. I'll give it a try!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 12-09-2005, 04:53 AM
TheExponential TheExponential is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
TheExponential is on a distinguished road
I have been able to compile the Library, but it fails in the import.

I have called my library program TELib.mq4. I've compiled and put it in the library path.

in using it, I wrote #import "TELib.ex4". And ends it with empty #import statement.

but it still complains when I refer to functions in the import.

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 12-09-2005, 04:56 AM
TheExponential TheExponential is offline
Junior Member
 
Join Date: Nov 2005
Posts: 17
TheExponential is on a distinguished road
I've also failed to use the standard stdlib.ex4 that MetaQuotes provides.

I tried to access ErrorDescription function, and it complains that the function is not defined.

Thanks again
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
#import charliev Metatrader 4 8 04-06-2008 07:07 AM
2 questions on codergurus course hayseed Setup Questions 3 12-07-2006 10:56 PM
Import custom DLL The_N Expert Advisors - Metatrader 4 1 05-30-2006 09:09 PM
MT3 Questions Nicholishen Metatrader 3 1 02-01-2006 03:10 PM


All times are GMT. The time now is 08:24 PM.