A library problem

Discuss anything else that does not suite other forums.

Moderator: Rathinagiri

User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

A library problem

Post by esgici »

Hi

Upon a problem I had encountered while building a HMG project, I had write this to Harbour:
- hbmk2 say :
...lib/libhbct.a(charop.o):charop.c:(.text+0xa40): multiple definition of
`HB_FUN_CHARXOR'
...lib/libcrypt.a(c_crypt.o):c_crypt.c:(.text+0x0): first defined here
and responded (by Przemek) like this :
Sorry but libcrypt.a is not part of Harbour.
I do not know where did you take this library from and what it does
but it tries creates name conflict with CHARXOR() function in HBCT
library. You should contact with this library author and ask about
the fix.
First my fault by saying hbmk2 say, and second, how would correct this conflict ?

Regards

--

Esgici

PS: IMHO libcrypt.a would rewrite from scratch and this is necessary.
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: A library problem

Post by Rathinagiri »

Thanks for the info Esgici.

Can this be avoided?! ie., to ignore the second occurrence?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: A library problem

Post by esgici »

rathinagiri wrote: Can this be override?! ie., to ignore the second occurrence?
IMHO yes; but by first author of this library ;)

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: A library problem

Post by Rathinagiri »

It is ok. However I wish to know whether there is any linker option to ignore the second occurrence.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: A library problem

Post by Rathinagiri »

I had seen the source code for crypt library in c:\hmg\source\crypt\h_crypt.prg. There is a HB_FUNCTION definition of charxor() in c_crypt.c.

So, to avoid the error, we can do one of the following two.

1. If the original charxor function and the Harbour charxor function are giving similar results, we can delete c_crypt.c and recompile & rebuild the libcrypt.a. :)

2. If we want to retain both the functions, then we can rename charxor function to another name in both h_crypt.prg and c_crypt.c. Then again, recompile and rebuild the library.

That's all.

I am enclosing the new libcrypt.a using the second method. Kindly backup old libcrypt.a and replace the new one and recompile your project.
libcrypt.zip
(4.02 KiB) Downloaded 279 times
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: A library problem

Post by esgici »

rathinagiri wrote: I am enclosing the new libcrypt.a using the second method.
Hi Rathi

Thanks, worked :)

I hope Roberto confirm modification and include in next release.

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Roberto Lopez
HMG Founder
Posts: 4023
Joined: Wed Jul 30, 2008 6:43 pm

Re: A library problem

Post by Roberto Lopez »

rathinagiri wrote:I had seen the source code for crypt library in c:\hmg\source\crypt\h_crypt.prg. There is a HB_FUNCTION definition of charxor() in c_crypt.c.

So, to avoid the error, we can do one of the following two.

1. If the original charxor function and the Harbour charxor function are giving similar results, we can delete c_crypt.c and recompile & rebuild the libcrypt.a. :)

2. If we want to retain both the functions, then we can rename charxor function to another name in both h_crypt.prg and c_crypt.c. Then again, recompile and rebuild the library.

That's all.

I am enclosing the new libcrypt.a using the second method. Kindly backup old libcrypt.a and replace the new one and recompile your project.
libcrypt.zip
AFAIR the author is Grigory. perhaps, it could be better if he post here an updated version.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: A library problem

Post by esgici »

Hi
rathinagiri wrote: If the original charxor function and the Harbour charxor function are giving similar results, we can delete c_crypt.c and recompile & rebuild the libcrypt.a. :)
Results must be similar, I don't know is (exactly) same; but tested and no problem encountered.
makefile.rar
Make file for building (new) libcrypt.a
(355 Bytes) Downloaded 281 times
Regards

--

Esgici
Viva INTERNATIONAL HMG :D
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: A library problem

Post by Rathinagiri »

Thanks a lot Esgici. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: A library problem

Post by esgici »

Hi

Now, I Know: result is same :)

Code: Select all

PROC TestCharXOR()
    
   LOCAL cXOredHRB := CHARXOR( "This is a string", "this is password" ),;
         cXOredHMG := CHARXOR_2( "This is a string", "this is password" )  // renamed and re-libbed c_crypt.c.
         
   MsgInfo( "Result is " + IF( cXOredHRB == cXOredHMG, "same.", "different." ) )      
   
RETU // TestCharXOR()


Regards

--

Esgici
Viva INTERNATIONAL HMG :D
Post Reply