如何--自定义函数执行gnu ld命令

我想在汇编编译后执行ld命令写了个函数,如下:

(defun vwiss/gnu–ld ()

“Gun ld command.”

(interactive)

(let*

  ((filename (file-name-sans-extension buffer-file-name))

   (file (concat filename ".o")))

(if (file-exists-p file)

	(progn

	  (set (make-local-variable 'compile-command)

		   (format "ld -m elf_i386 -s -o %s %s"

				   filename file))

	  (compile compile-command))
  )
)

)

没有执行compile函数。这个应该怎么操作?求解。。。

自己找到错误的地方了

调用compile函数搞错了。 正确的写法应该是:

(call-interactively 'compile)

顺便问下,有没有可以知道当前系统是32位还是64位的函数?

手里没电脑,手机找到的SO: How to determine operating system bits (32 vs 64-bit) in elisp - Emacs Stack Exchange

@casouri 非常感谢,研究下先。

有结果了我会告知

看了一下,里面说的system-configurationmost-positive-fixnum都可以用。

我的设备上system-configuration的值是"x86_64-apple-darwin18.7.0",我想可以用regexp找x86/x86_64这样的关键词。

most-positive-fixnum可能更直接一点,32位上最多是2^32(4294967296),更大的数估计就是64位了。

我就用了system-configuration,对我够用。

我也就是判断下是什么系统好执行汇编链接命令。我一般就是在linux下面。现在是够用了。

win下面我看了下regexp x86_64也没问题

建议更改标题为以下形式:

如何{原标题}?

好的,下次注意,谢谢