Function of FiveWin and with my same name

Post Reply
User avatar
Eroni
Posts: 71
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil
Contact:

Function of FiveWin and with my same name

Post by Eroni »

Good afternoon, I have a lib I use to put my own functions
But when you run the application, rather than performing my functions are performed
FiveWin functions that have the same name, does anyone know why this?
Use the xmate and always worked ok, my lib was always first on the list, before the FiveWin now just because I changed the name of
project was well. For example, the alert function I had rewritten it and
worked according to my source, now operates the original alert.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Function of FiveWin and with my same name

Post by Antonio Linares »

Americo,

In order to overwrite some FWH functions, you can link them before FiveH.lib or simply include them in on of your PRGs
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Eroni
Posts: 71
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil
Contact:

Re: Function of FiveWin and with my same name

Post by Eroni »

Antonio, thank you.

Exactly the way I use, see example of linking script below:

Image

Maybe can be a xmate problem?

Regards
FWH 1709 BCC72 MySql MariaDB
Visual Studio 2019 / Xamarin / C#
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Function of FiveWin and with my same name

Post by Antonio Linares »

Yes, surely that is the problem.

Have you tried to build it using buildx.bat from FWH samples folder ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Function of FiveWin and with my same name

Post by James Bott »

Maybe xMate is not linking in your lib--perhaps due to the long filename and/or the underscores in it. Or maybe it can't find it due to the path.

Can you check to see if another one of your functions without a conflicting name is callable? If not, then the lib is not getting linked.

Regards,
James
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Function of FiveWin and with my same name

Post by Antonio Linares »

Americo,

You may try our vmh.exe (full source code included) that provides a GUI to Harbour's hbmk2.exe:

https://code.google.com/p/fivewin-contr ... 130330.zip

As the entire source code is available, you can modify it to link your lib in the exact place where you may need it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Eroni
Posts: 71
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil
Contact:

Re: Function of FiveWin and with my same name

Post by Eroni »

[quote="
Have you tried to build it using buildx.bat from FWH samples folder ?[/quote]

Yes, builldx.bat works ok, but I tested with few sources.

Thanks
FWH 1709 BCC72 MySql MariaDB
Visual Studio 2019 / Xamarin / C#
User avatar
Eroni
Posts: 71
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil
Contact:

Re: Function of FiveWin and with my same name

Post by Eroni »

Thanks James, the functions are not conflicting with names commonly called, are the really the problem that has the same name. The surprising thing is that always worked well for a long time, I just changed the folder name and the project did not work and more.

I started testing with the suggestion of Antonio vmh.exe as though, as my project is very large, are more than 500 sources, would need more time to reconfigure. It would be a good option for the future, however now need to generate application quickly.

Regards
FWH 1709 BCC72 MySql MariaDB
Visual Studio 2019 / Xamarin / C#
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Re: Function of FiveWin and with my same name

Post by James Bott »

Maybe you can just change the folder name back to the original name.
User avatar
Eroni
Posts: 71
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil
Contact:

Re: Function of FiveWin and with my same name

Post by Eroni »

James Bott wrote:Maybe you can just change the folder name back to the original name.
Thank you, I already try.
FWH 1709 BCC72 MySql MariaDB
Visual Studio 2019 / Xamarin / C#
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Function of FiveWin and with my same name

Post by nageswaragunupudi »

The problem is not with xMate. The job of any builder ends with generating the script and executing the compiler and linker. xMate did its job well as can be seen from the link script.

Now the real question what the linker does.

Assume that I am linking MyLib.Lib first and then FiveX.Lib next.
I have a function func1() in module mymod1.prg in mylib.lib
There are two functions func1() and func2() in module fwmod1.prg in fivex.lib.
My application prg has a call to func1() and does not call func2() directly or indirectly.

Now the linker has no confusion. The linker links mymod1.obj from mylib.lib (priority) ignoring fwmod1.obj in fivex.lib.

Next:
Assume I revised my application. Now my application calls some function which in turn calls func2() which is only in fwmod1.obj inside fivex.lib.

What does the linker do? The linker has to link both func1() and func2() and it finds mymod1.obj in mylib.lib which contains func1() only and module fwmod1.obj inside fivex.lib which contains both func1() and func2(). Which module does it include in the exe?
Let us keep in mind that linker links entire modules and does not split modules for different functions ( unlike Blinker in the good old 16-bit clipper days)

Now the logical choice for the linker is to choose fwmod1.obj from fivex.lib instead of mymod1 from mylib.lib. Extending this logic we can also expect situations where duplicate symbols may need to be linked but that generates a log file to indicate the issue.

I happily stand corrected where I am wrong if pointed out by our experts.

I always feel that having functions with the same names as in fivewin or (x)Harbour (or 3rd party libs we are using) is like carrying timebombs in our pockets. It is definitely worth all the time we spend to avoid conflicting names of functions.

It is a good thing that FWH is now prefixing "FW_" before any new utility functions being added to FWH libs.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Eroni
Posts: 71
Joined: Fri Jul 21, 2006 7:15 pm
Location: Criciuma/SC Brazil
Contact:

Re: Function of FiveWin and with my same name

Post by Eroni »

nageswaragunupudi,
Many thanks for your excellent explanation, I now understand in a general way the process of linker, was already examining the file .map, but your explanation cleared me well. I chose to change the names of functions conflicting with the FiveWin, however, has not managed to make it work and errorsys helpsys, but I already have almost everything working again. I believe this very interesting subject for future study.
Thanks for the great help.
FWH 1709 BCC72 MySql MariaDB
Visual Studio 2019 / Xamarin / C#
Post Reply