Sunday, June 10, 2012

Why did Manny Pacquiao lose to Timothy Bradley, Jr?

Why did Manny Pacquiao lose to Timothy Bradley, Jr?  In order for Manny to understand the meaning of true biblical Christianity as he was telling the whole world few months before the fight that he was converted to the true Christian faith. What is it? Well, it was written in the cloak of Evander Holyfield (a world boxing champion whose ear was bitten by Mike Tyson): "I can do all things through Christ who strengthens me" (Philippians 4:13).


Where's Freddie Roach, Manny's coach, or where's Pacquiao's strength? Well, it was all true before Manny's conversion, if it is true that he became a born-again Christian already. For God said that "I will not give my glory to another." God doesn't want Manny to glorify himself. God gave Manny Christian Lesson 101: "You will win Manny according to My will, not yours or Roach's.


 For My own sake, for My own sake, I will act;
For how can My name be profaned?
And My glory I will not give to another. Isaiah 48:11

Saturday, June 9, 2012

MingW error: Undefined reference to HB_FUN

Have you noticed that hbmk2 will always report an "undefined reference to HB_FUN_..." error if it cannot find the function you referred to or cannot find the library where the same function stayed? Here's an example of this error, especially so if you are using MingW compiler:

filexxx.c:(data+0x58): undefined reference to 'HB_FUN_FUNCTIONNAME'

BCC is more tolerant than MingW. I tried to compile a libmyLib.a where my functions relied on the codes in hbwin, hbxpp, and hbct libraries of Harbour contrib. You may try this experiment:


////// file mylib.prg
function try1()
  ? win_printergetdefault() // requires hbwin library
return nil



function try2()
   sleep(50) // requires hbxpp library
return nil

function try3()
  ? volserial() // requires hbct library
return nil



Try to compile the above codes using hbmk2, compiler=mingw, if you want to see the above error: undefined reference to HB_FUN...


Not only that, should you succeed by using the

 -l switch or
{mingw}libs=${hb_dir}libs${hb_name}.a  // (this switch worked for me)

in compiling your myLib library. For your next problem will be in the actual "swordfight" of your myLib library, since MingW cannot find easily whatever function you wrote in your myLib library. All you need to do is to hire big "L" switch, then the small "l" switch. The so-called big "L" tells the path, whereas, the lower case "l" tells about the library. Here's how to do it in your .hbp file or at the command line:



-LD:\myDir\myWork
-lmyLib (don't include the prefix (lib) and the file extension name, ".a"


Still these hbmk2 options won't work if you have imported functions from other libraries, f.e., hbwin.


Why? Because you need also to mention in your exe hbp the names of the contril libs where you based your myLib libraries.

I have this experience since I have functions in my XBase++ days which used XBTools III like volserial() which is very important to me. I want to share the following .hbp files, one for the lib, and the other for the exe file.

################## .hbp for the library file, example: myLib Library
## myLib.hbp


-inc
-w3 -es2
-workdir=HB/${hb_comp}
-hbx=blah.hbx        < try it, it's okey
{mingw}libs=${hb_dir}libs${hb_name}.a
-hblib
-info
-omyLib

 ################## .hbp for the exe file, example: try.exe
 ## try.hbp


-w3 -es2
-mt
-trace
-inc
-lhbxpp
-lhbct
-lhbwin
-LD:\dev\2012\myprog
-lmyLib
-info
-otry

Note that I am careful about the listing order of my libraries. From the forum, I learned Victor saying that ordering of libraries is a factor for the compiler.

My other blog on this topic may be of interest to you at My Harbour Notes: MingW cannot find my libraries.



Tuesday, June 5, 2012

MinGW can't find my libraries

 How to command MinGW using hbmk2 to read my own libraries during compilation of a Harbour source code? Unlike BCC, MinGW is always playing "hard-to-get" to newbies like me. So I made an experiment I would like to share with you. I created a library known as "myLib". With BCC the compiled file name will always be: myLib.LIB; whereas, with MinGW, a prefix "lib" is added to the file name, hence the resulting lib file would look like this:
"libmyLib.a". Note that the suffix is ".a", not ".lib".

1) First Step: Let's create a library.

////////////////////////////////// A program that returns the current path.
/////////////////////////////////// Usage: ? GetPath() --> D:\dev\lib
/////////////////////////////////// File name: trylib.prg
 FUNCTION GetPath()
  RETURN (DiskName()+":\"+CurDir())


2) Second Step: Let's compile our .prg named trylib.prg for us to produce libmyLib.a. In order to prepare our myLib library to contain more functions in the future we need to create an .hbp (Harbour project file. In XBase++, it is termed as .xpj file).

##  myLib.hbp - hbp filename.

# this .hbp file contains only one .prg named trylib.prg which contains a GetPath() function.  

# hblib is the hbmk2 option we need to use in creating a library

 -hblib

# for our compiler, let's use the -compiler switch. If you use a batch file, use
#    set HB_COMPILER=mingw

 -compiler=mingw

# switch -o is needed in order to control the name of the resulting output file.
# We want the name: myLib
-omyLib

# let's now include our .prg/s
trylib.prg

# done

3) Third Step: Let's write our main.prg, which will call our myLib library

/////////////////////////////////// A program that calls getpath() from myLib library
///////////////////////////////////              also known as libmyLib.a
/////////////////////////////////// Usage: just type try.exe at the dot prompt
/////////////////////////////////// File name: try.prg
FUNCTION Main()

cls

? getpath() // returns your current path

inkey(0)

RETURN NIL

4) Fourth Step: Let's write now our .hbp file for our project known as try.exe program. Use number sign "#" to make comments.

## try.hbp, the name of our .hbp file.

# for our compiler
-compiler=mingw

# if we want to control which directory hbmk2 has to do its compiling routines
# after your current path, you will find a new path HB\win\mingw
# hb_plat for platform; hb_comp for compiler

-workdir=HB/${hb_plat}/${hb_comp}

# this is key to command mingw to find your own library.
#     In my experience, mingw can't see your lib file even
#    if it is located in the directory where you compiled your source codes.
# use the following hbmk2 switch: an upper case "L" or -L then your path/current directory

-LD:\dev\lib


# note that in my experiment I didn't add the name of my library, just the path where my library stays.
# then I added another hbmk2 switch, -l, where I need to mention already the name of my library
# take note that this time it is small letter "l" or -l.

-lmyLib


# minGW created libmyLib.a, but I need to write only: -lmyLib


# the name of my output: try.exe, I need the switch -o
-otry


5) Fifth Step: We're almost done, but to make things easier and fast, let's create a batch file we call s.bat (s because I'm left-handed and I want to just easily press s on my keyboard for a trial-and-error compilation I am doing many times in the course of creating a software).

rem batch file name: s.bat
rem I want to set again my compiler, because I want to make sure. To avoid redundancy,
rem you may delete the one written in our .hbp, namely: -compiler=mingw

cls

set HB_COMPILER=mingw

hbmk2 myLib.hbp

rem after compiling our myLib library, we may delete already the above command

rem the added command "1>log.txt 2>&1 is for our log file necessary in tracing errors.

hbmk2 try.hbp 1>log.txt 2>&1

6. Sixth Step. At the command prompt type "dir" to see: try.exe and libmyLib.a. If you'll find them, it means you succeeded. Now is the time to type "try" to see it minGW finds your library. If you are successful you'll find something like this on your screen depending of course on the name of your path:

D> D>dev\myLib

Having the above on your screen, it means the function getpath() in our myLib library was successfully called by try.exe.

Thanks for the patience. Happy Harbour-ing!

Monday, June 4, 2012

How to save hbmk2's error messages?

If you are familiar with XBase++'s PBuild, you will notice that error messages during compilation are written into an "error.log." Do we have the same feature with our hbmk2? Of course the ">" (greater than) sign will normally save messages to a text file if you will place them in a batch file. For example:

                            try1.bat

                            c:> dir *.prg /b > log.txt

                            The result of the above command will look like this:

                                     try1.prg
                                     try2.prg, etc


In hbmk2, all you have to do in order to save error messages during compilation into a log file is this one (put together into a batch file):


                               try2.bat
              
                               set HB_COMPILER=mingw
                               hbmk2 try.hbp -rebuild 1> log.txt 2>&1

This above saves anything displayed on screen during complilation into a text file, in this example, log.txt.

Remove This copy of Windows 7 is not genuine Build 7600

How to remove this annoying message: "This copy of Windows 7 is not genuine Build 7600"? It was just a wink of an eye: your screen turned black then the above message. I surfed the Web and found RemoveWat.Exe for the solution of it.


After downloading it, I noticed a folder which has this name: RemoveWat 2.2.6 Hazar SCTV83.blogspot. I checked the properties of this free "Exe" and the following info came out:



Details

File Description           RemoveWat
Type Application File   Version 2.2.6.0
Copyright                    Copyright Hazar & Co. (c) 2010
Size                             6.35 MB
Date Modified             9/19/2010 9:05 PM
Language                    Language Neutral
Original Filename        RemoveWat

Judge for yourself if RemoveWat is not worthy of one's trust. I am so happy finding it, for it finally solved the "not genuine" mark in my desktop. Although RemoveWat didn't help my friend's computer, it perfectly helped mine and for it I wanted to suggest to one having the same problem to try RemoveWat (it removes "other things" also!).