mb_compile_ex

Previous  Next

 

status_t mb_compile_ex( mb_interpreter_t* s, const char* strFileName, const char* lpPassword, bool_t bPwdEncoded, WORD wLog, char* pLog )

 


 

Compiles the currently loaded file or string to a MyBASIC2 Compiled file.  This is not a true executable file.  It is an object file that has been parsed for faster execution and to be able to protect the file from reverse engineering or modifications.

 

The extended version of mb_compile allows you to specify a password and log options.  If the bPwdEncoded is TRUE, then the password is considered encoded and will not be encoded with the built-in password encoding.  You can specify log options as well.  If the pLog parameters is NULL the log is output using current output handler.  If not NULL, then this is a pointer to a buffer that will contain the log from compile.

 

Example

 

mb_interpreter_t*  bas = NULL;

char               strMyFile[_MAX_PATH];

char               strPassWord[32];

 

printf( "_Enter File: " );

scanf( "%s", strMyFile );

 

printf( "_Enter Password: " );

scanf( "%s", strPassWord );

 

mb_open( &bas );

 

if ( mb_load_file( bas, strMyFile ) == MB_FUNC_OK )

{

  // Compile file to same name but with .BAC extension

  mb_compile_ex( bas, NULL, strPassWord, FALSE, MB_LOG_BRIEF, NULL );

}

mb_close( &bas )