简体   繁体   English

Metal C中的memset问题

[英]problems with memset in Metal C

I'm trying to initialize the Metal C environment with the following code, but get the following errors on the memset line. 我正在尝试使用以下代码初始化Metal C环境,但在memset行上会出现以下错误。 ERROR CCN3275 IMIJWS0.METAL.SAMPLIB(MEM):6 Unexpected text ')' encountered. ERROR CCN3275 IMIJWS0.METAL.SAMPLIB(MEM):遇到6个意外的文本')'。 ERROR CCN3045 IMIJWS0.METAL.SAMPLIB(MEM):6 Undeclared identifier ___MEMSET. 错误CCN3045 IMIJWS0.METAL.SAMPLIB(MEM):6未声明的标识符___MEMSET。 ERROR CCN3277 IMIJWS0.METAL.SAMPLIB(MEM):6 Syntax error: possible missing ')' or ','? 错误CCN3277 IMIJWS0.METAL.SAMPLIB(MEM):6语法错误:可能缺少')'或','? CCN0793(I) Compilation failed for file //'IMIJWS0.METAL.SAMPLIB(MEM)'. CCN0793(I)文件//'IMIJWS0.METAL.SAMPLIB(MEM)'的编译失败。 Object file not created. 未创建对象文件。 Below is my code 以下是我的代码


   #include < string.h>
   #include < stdlib.h>
   #include < metal.h>
   void mymtlfcn(void)  {
   struct __csysenv_s mysysenv;
   memset ( &mysysenv, 0, sizeof ( mysysenv ) );
   mysysenv.__cseversion = __CSE_VERSION_1;
   mysysenv.__csesubpool = 129;
   mysysenv.__cseheap31initsize = 131072;
   mysysenv.__cseheap31incrsize = 8192;
   mysysenv.__cseheap64initsize = 20;
   mysysenv.__cseheap64incrsize = 1;

The issue was with the search order. 问题在于搜索顺序。 Although I did search(/usr/metal/include) from with in my JCL I didn't proceed it with a nosearch option, so string.h was getting picked up from the standard system librarys instead of the version included with Metal C. I've pasted my optfile dataset I passed to the CPARM below for refference. 虽然我在我的JCL中搜索了(/ usr / metal / include),但我没有使用nosearch选项,因此string.h从标准系统库中取而代之,而不是Metal C中包含的版本。我已粘贴我传递给下面的CPARM的optfile数据集以进行参考。

//OPTIONS DD *
 SO
 LIST
 LONG
 NOXREF
 CSECT
 METAL
 LP64
 NOSEARCH
 search(/usr/include/metal/)

So, I have no idea. 所以,我不知道。 But some suggestions: 但有些建议:

  1. You might try copying/pasting this code here from this example just to make sure it works 'as expected' 您可以尝试从此示例中复制/粘贴此代码,以确保其“按预期”工作

  2. Maybe try defining some of the macros here ? 也许尝试在这里定义一些宏? (when I did C programming on zOS, I had to do include some weird macros in order to get stuff to work. I have no reasonable technical explanation for this.) (当我在zOS上进行C编程时,我必须要包含一些奇怪的宏才能让内容工作。我没有合理的技术解释。)

  3. You could try searching for memset() using "=3.14" (from ispf.) See if any other modules use that function, and then check the headers that they include (or macros that they define - either in the C files or H files) to make it work. 您可以尝试使用“= 3.14”(来自ispf)搜索memset()。查看是否有任何其他模块使用该函数,然后检查它们包含的标头(或它们定义的宏 - 在C文件或H文件中)使它工作。

  4. Another thought: before the memset(), try doing putting a printf() in. If you get a syntax error on the same line (only for printf, rather than memset) then you can see if the problem is before line 6 - like a misplaced parenthesis. 另一个想法:在memset()之前,尝试将printf()放入。如果在同一行上出现语法错误(仅用于printf,而不是memset),那么你可以看到问题是否在第6行之前 - 就像一个错位的括号。

  5. Finally, if i recall correctly, I had to compile my individual modules, and then link them manually (unless I wrote a JCL to do this for me.) So you might have to link once to link with your other modules, and then link again against the C library. 最后,如果我没记错,我必须编译我的单个模块,然后手动链接它们(除非我写了一个JCL来为我做这个。)所以你可能需要链接一次链接到你的其他模块,然后链接再次反对C库。 Not to be pedantic, but: you're fairly certain that you're doing all of the link passes? 不要迂腐,但是:你相当肯定你正在做所有的链接传递?

I realize that's a lot of hoops to try and you've probably already read the manuals, but maybe there is something useful to try? 我意识到要尝试很多箍,你可能已经阅读过这些手册,但也许有一些有用的尝试?

Also, and you probably already know this, but this site (for looking up error codes) is infinitely useful. 此外,你可能已经知道这一点,但这个网站 (用于查找错误代码)是无限有用的。 (along with the above links for full-text-searching the manual) (以及上述用于全文搜索手册的链接)

Edit: this page also talks about "built-in functions" - you could try (as stated at the bottom of the page) "#undef memcpy" to use the non-built-in version? 编辑: 此页面还讨论“内置函数” - 您可以尝试(如页面底部所述)“#undef memcpy”来使用非内置版本?

Can you show us your compiler arguments? 你能告诉我们你的编译器参数吗? You need to make sure that you're not pulling in the standard C header files in addition to the metal C ones. 除了金属C文件之外,您还需要确保不要使用标准C头文件。 Here's an example: 这是一个例子:

xlc -c -Wc,metal,longname,nosearch,'list(./)'  -I. -I /usr/include/metal -I "//'SYS1.SIEAHDRV'" -S -qlanglvl=extended foo.c
as -mrent -mgoff -a=foo.list -o foo.o foo.s
ld -bac=1 -brent -S "//'SYS1.CSSLIB'" -o foo foo.o

Are you missing the closing brace '}' for the function? 你错过了函数的右括号'}'吗? How about any missing semi-colon line terminators? 任何缺少的分号线终止符怎么样? When missing braces/semi-colons the z/OS C compiler throws some strange/misleading messages sometimes. 当缺少大括号/分号时,z / OS C编译器有时会抛出一些奇怪的/误导性的消息。 I don't have it to try out, but I'm assuming Metal does as well. 我没有尝试,但我认为Metal也是如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM