I've never used Metal C, but for the first problem (undeclared __MEMSET), I
would look to see if there's a string.h that can be used. That's normally
where memcmp is defined.

As for the runtime problem, I'd guess it had something to do with using 
'sizeof' incorrectly. It looks as if you are compiling 64-bit which would
mean that 'sizeof(xarg)' is going to be 8. If you replace all the sizeofs
with strlens, I think you'd see it work.


In article 
<bn7pr08mb4786103ab1acc10f15d91eeba8...@bn7pr08mb4786.namprd08.prod.outlook.com>
 you wrote:
> I'm a developer working with a client to develop Metal C functions for their 
> products. Up until recently I've defined __METAL_STATIC and linked with 
> SCCR3BND. I decided recently to play with the dynamic library in LPALIB so I 
> removed that #define. What I'm getting is compile errors on the substitution 
> macros from metal.h. That is the first problem. I decided to try and 
> circumvent the compile errors and I think I found a bug in the memcmp library 
> function. That is the second problem. I'm really hoping someone will tell me 
> I missed something really obvious or missed some maintenance.

> I created a trivial sample program to demonstrate:

> /*
>   Sample for Metal C
> */

> #include <stdio.h>
> #include <stdlib.h>

> int main(int argc, char** argv)
> {
>   char* xarg = "abcd";
>   void *mem = malloc(64);
>   memset(mem, 0x0f, 64);
>   memcpy(mem, xarg, sizeof(xarg));
>   int mcmp = memcmp(mem, xarg, sizeof(xarg));
>   free(mem);
> }


-- 
Don Poitras

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to