第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

鏈接到 libavformat 的最小 Cgo 應(yīng)用程序意外執(zhí)行

鏈接到 libavformat 的最小 Cgo 應(yīng)用程序意外執(zhí)行

Go
繁星淼淼 2023-08-14 14:47:17
我有一個(gè)最小的 C 程序#include <libavformat/avformat.h>AVFormatContext *open(const char *url) {    printf("URL %s\n", url);    AVFormatContext *ctx = NULL;    int err = avformat_open_input(&ctx, url, 0, 0);    return ctx;}int main(int argc, char **argv) {    open(argv[1]);}它可以工作,它打印我傳入的文件路徑,并返回一個(gè)有效的 AVFormatContext。我將代碼粘貼到 Golang 程序中:package main// #include <libavformat/avformat.h>//  AVFormatContext *open(const char *url) {//  printf("URL %s\n", url);//  AVFormatContext *ctx = NULL;//  int err = avformat_open_input(&ctx, url, 0, 0);//  return ctx;//  }//  #cgo LDFLAGS: -lavformatimport "C"import (    "fmt"    "os")func main() {    fmt.Println("Lets try this")    url := os.Args[1]    C.open(C.CString(url))}這會(huì)打印URL /dev/urandom(無(wú)論我給它什么參數(shù))并掛起。非常奇怪的是,它不打印Lets try this。這是在 Mac 上使用 ffmpeg 并從自制程序轉(zhuǎn)到:ffmpeg version 4.2.1Copyright (c) 2000-2019 the FFmpeg developers   built with Apple clang version 11.0.0 (clang-1100.0.33.8)go version go1.13.4 darwin/amd64我目前的猜測(cè)是編譯器 ABI 不兼容,或者 libavformat 在 main() 之前運(yùn)行某些內(nèi)容?
查看完整描述

1 回答

?
犯罪嫌疑人X

TA貢獻(xiàn)2080條經(jīng)驗(yàn) 獲得超4個(gè)贊

問(wèn)題出在函數(shù)名稱上open。它屏蔽了系統(tǒng)調(diào)用 open,go 必須在到達(dá) main 之前調(diào)用。



查看完整回答
反對(duì) 回復(fù) 2023-08-14
  • 1 回答
  • 0 關(guān)注
  • 141 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)