Metal C 中的 memset 问题

发布于 2024-07-23 06:46:02 字数 759 浏览 10 评论 0原文

我尝试使用以下代码初始化 Metal C 环境,但在 memset 行上出现以下错误。 错误 CCN3275 IMIJWS0.METAL.SAMPLIB(MEM):6 遇到意外文本“)”。 错误 CCN3045 IMIJWS0.METAL.SAMPLIB(MEM):6 未声明的标识符 ___MEMSET。 错误 CCN3277 IMIJWS0.METAL.SAMPLIB(MEM):6 语法错误:可能缺少 ')' 或 ','? CCN0793(I) 文件 //'IMIJWS0.METAL.SAMPLIB(MEM)' 编译失败。 未创建目标文件。 下面是我的代码


   #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;

I’m trying to initialize the Metal C environment with the following code, but get the following errors on the memset line.
ERROR CCN3275 IMIJWS0.METAL.SAMPLIB(MEM):6 Unexpected text ')' encountered.
ERROR CCN3045 IMIJWS0.METAL.SAMPLIB(MEM):6 Undeclared identifier ___MEMSET.
ERROR CCN3277 IMIJWS0.METAL.SAMPLIB(MEM):6 Syntax error: possible missing ')' or ','?
CCN0793(I) Compilation failed for file //'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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

别闹i 2024-07-30 06:46:02

问题出在搜索顺序上。 虽然我在 JCL 中使用 with 进行了搜索(/usr/metal/include),但我没有使用 nosearch 选项进行搜索,因此 string.h 是从标准系统库中获取的,而不是从 Metal C 包含的版本中获取的。我已将传递给 CPARM 的 optfile 数据集粘贴到下面以供参考。

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

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.

//OPTIONS DD *
 SO
 LIST
 LONG
 NOXREF
 CSECT
 METAL
 LP64
 NOSEARCH
 search(/usr/include/metal/)
因为看清所以看轻 2024-07-30 06:46:02

所以,我不知道。 但一些建议:

  1. 您可以尝试从 此示例 只是为了确保它“按预期”工作

  2. 也许尝试定义一些此处 ? (当我在 zOS 上进行 C 编程时,我必须包含一些奇怪的宏才能让东西正常工作。对此我没有合理的技术解释。)也许

  3. 您可以尝试使用“=3.14”搜索 memset() “(来自 ispf。)查看是否有任何其他模块使用该函数,然后检查它们包含的标头(或它们定义的宏 - 在 C 文件或 H 文件中)以使其正常工作。

  4. 另一个想法:在 memset() 之前,尝试放入 printf() 。如果在同一行上出现语法错误(仅适用于 printf,而不是 memset),那么您可以查看问题是否在行之前6 - 就像放错了括号。

  5. 最后,如果我没记错的话,我必须编译我的各个模块,然后手动链接它们(除非我编写了 JCL 来为我执行此操作。)因此您可能需要链接一次才能与其他模块链接,然后再次链接 C 库。 不是迂腐,但是:您相当确定您正在执行所有链接传递?

我意识到需要尝试很多圈子,并且您可能已经阅读了手册,但也许有一些有用的东西可以尝试?

另外,您可能已经知道这一点,但是 这个网站(用于查找错误代码)非常有用。 (以及上面用于全文搜索手册的链接)

编辑:此页面还讨论了“内置函数” - 您可以尝试(如页面底部所述)“#undef memcpy”来使用非内置函数在版本中?

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.)

  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.

  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.

  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. 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?

渡你暖光 2024-07-30 06:46:02

您能向我们展示您的编译器参数吗? 您需要确保除了金属 C 头文件之外,您没有引入标准 C 头文件。 这是一个例子:

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

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. 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
青朷 2024-07-30 06:46:02

您是否缺少函数的右大括号“}”? 缺少分号行终止符怎么样? 当缺少大括号/分号时,z/OS C 编译器有时会抛出一些奇怪/误导性的消息。 我没有尝试过,但我假设 Metal 也可以。

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. I don't have it to try out, but I'm assuming Metal does as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文