We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I have a question regarding this sample code. I created a new source containing this code in both examples_lp64 and examples_ilp64 folders and added the new file to the both makefiles to compile it. For the 32-bit version it works well and outputs the correct result ( Value of r: 0.123400 ) but for the 64-bit one, it results in an error (NMAKE : fatal error U1077: 'test.exe' : return code '0xc0000005' ). Am I doing something wrong, or what can the problem be ?
#include <stdlib.h> #include <stdio.h> float x[4] = { 1, 2, 3, 4 }; float y[4] = { .1, .01, .001, .0001 }; int four = 4; int one = 1; extern float sdot_(); int main() { int i; double r = sdot_(&four, x, &one, y, &one); printf("Value of r: %f\n", r); return 0; }
Hi,
Looks like you're passing the integer arguments to `sdot_` as pointers to 32-bit integers. When linking against the 64-bit library, you'll need to ensure that you pass in 64-bit integers.
You can either correct this by instead passing in pointers to `int64_t` types in your 64-bit example:
int64_t four = 4; int64_t one = 1;
Or for both 32-bit & 64-bit examples, you can include armpl.h and use the `armpl_int_t` typedef to get the correct integer type that matches the interface:
#include <armpl.h> armpl_int_t four = 4; armpl_int_t one = 1;
For more information on the 64-bit integer interface, please see: https://developer.arm.com/documentation/101004/2404/General-information/Arm-Performance-Libraries-variants-using-64-bit-integer-arguments.
Hope this helps!
Aymen