Highlighted
Honored Contributor.
Honored Contributor.
671 views

Problem to use bsearch() function in VuGen

Jump to solution

HI all
I am triying to use the bsearch() function which is configured into "stdlib.h" library. Every run the error is:
Action.c(15): Error: C interpreter run time error: Action.c (15):  Error -- memory violation : Exception ACCESS_VIOLATION received.
I need a help to undestand what is the error and how to work with this function
I attached a script named WebHttpHtml1.zip with a test example
Regards

0 Likes
1 Solution

Accepted Solutions
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Problem to use bsearch() function in VuGen

Jump to solution

I had a comparable issue by using qsort(). But it was rather easy so solve by taking a qsort source from a linux distro ( I used it from https://github.com/littlekernel/lk/blob/master/lib/libc/qsort.c). Added 'qsort.c' to Extra Files and put some defines around it around the source to make it work. The same should be possible with bsearch()

// Makes this keyword invisible
#define __inline
// Just take long as int
#define long int
// Note: redefine the function-name so it stays transparent and use in your code qsort().
#define qsort my_qsort

// Put here the source code
// Comment out the includes

// Unset the temporary defines and the defines from within the source because all the code is compiled in one module.
#undef long
#undef __inline
#undef swap
#undef vecswap
#undef SWAPINIT
#undef swapcode

Note you might consider to use '#define const' as well if you want to save some errors/warnings.

Signature:
Reward community members who take time to respond and help.

View solution in original post

Tags (2)
6 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Problem to use bsearch() function in VuGen

Jump to solution

Hi

Which LR version are you using?

Thanks,

Lior

0 Likes
Highlighted
Honored Contributor.
Honored Contributor.

Re: Problem to use bsearch() function in VuGen

Jump to solution

Hi Lior

I tried with VuGen SA 12.53, patch 2,3 and 4.

Regards

0 Likes
Highlighted
Micro Focus Contributor
Micro Focus Contributor

Re: Problem to use bsearch() function in VuGen

Jump to solution

Hi,

Currently, compiled library functions like bsearch() and qsort() to which we need pass a function adress as callback are not supported by Vugen.

Thanks,

Frank

0 Likes
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Problem to use bsearch() function in VuGen

Jump to solution

Hello @rleitons

I would like to know if the information provided was useful?
Please do not hesitate to let us know if you need something else.

Regards,

Daniela Gómez Alvarado
Customer Support Engineer

If you find that this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the post and show your appreciation.
0 Likes
Highlighted
Acclaimed Contributor.. Acclaimed Contributor..
Acclaimed Contributor..

Re: Problem to use bsearch() function in VuGen

Jump to solution

I had a comparable issue by using qsort(). But it was rather easy so solve by taking a qsort source from a linux distro ( I used it from https://github.com/littlekernel/lk/blob/master/lib/libc/qsort.c). Added 'qsort.c' to Extra Files and put some defines around it around the source to make it work. The same should be possible with bsearch()

// Makes this keyword invisible
#define __inline
// Just take long as int
#define long int
// Note: redefine the function-name so it stays transparent and use in your code qsort().
#define qsort my_qsort

// Put here the source code
// Comment out the includes

// Unset the temporary defines and the defines from within the source because all the code is compiled in one module.
#undef long
#undef __inline
#undef swap
#undef vecswap
#undef SWAPINIT
#undef swapcode

Note you might consider to use '#define const' as well if you want to save some errors/warnings.

Signature:
Reward community members who take time to respond and help.

View solution in original post

Tags (2)
Highlighted
Honored Contributor.
Honored Contributor.

Re: Problem to use bsearch() function in VuGen

Jump to solution

Thanks for the suggestion JHF

I copied the code from https://github.com/littlekernel/lk/blob/master/lib/libc/bsearch.c to the Vuser.ini and use it in the script.

Regards

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.