如何调用C例程lseek、ftell或fseek?我尝试过这个(macos 10.12.6):
import os
#flag -lsystem
#include <unistd.h>
seeker.v:150:11: error: unknown function: C.lseek
148 | // tell returns the current file position
149 | fn (f os.File) tell() int {
150 | return C.lseek(f.fd, 0, C.SEEK_CUR)
151 | }发布于 2020-05-28 14:16:58
你必须在使用C函数之前声明它们!
fn C.lseek(fd, offset, whence int)这允许V知道函数的参数,并键入check。
https://stackoverflow.com/questions/62009796
复制相似问题