我需要通過PInvoke在單聲道應用程序中調用此過程。 圖書館的名字請。Linux。哪個DLL包含execv?
-3
A
回答
2
身爲GNU C的件庫是在libc
:
using System;
using System.Runtime.InteropServices;
namespace posix
{
class MainClass
{
[DllImport ("libc", SetLastError=true)]
private static extern int system (string exec);
[DllImport ("libc", SetLastError=true)]
public static extern int execv (string path, string[] argv);
public static void Main (string[] args)
{
Console.WriteLine ("Error:{0}", system ("ls -l"));
Console.WriteLine ("Error:{0}", execv ("/usr/bin/vi", new string[] { "/usr/bin/vi" , "foobar.txt" }));
// Of course, being execv without failure we never come back...
Console.WriteLine ("Should never be displayed");
Console.WriteLine ("Error:{0}", Mono.Unix.Native.Syscall.execv ("/usr/bin/ls", new string[] { "/usr/bin/ls" }));
}
}
}
+0
找到錯誤。您必須複製程序名稱作爲第一個參數,例如:'execv(「nano」,new string [] {「nano」});' – biv
+0
您正確,更新了它,當您從內存中鍵入代碼... S.O。需要內聯C#編譯器/調試器;-) – SushiHangover
相關問題
- 1. 哪個.dll包含HTMLElement類?
- 2. 包含多個DLL的nuget包
- 3. 哪個DLL包含泛型擴展方法?
- 4. 查找哪個引用dll包含方法
- 5. 哪個DLL文件包含Aspose的TextFragment類
- 6. 哪個DLL或OCX包含VB 6.0對照實施
- 7. 哪個Linux頭文件包含「struct iface」的定義?
- 8. 哪個clojure jar包含clojure.contrib.io.Streams?
- 9. 哪個jar包含HttpClientConnectionManager?
- 10. 鏈接 - 包含哪個庫?
- 11. 哪個JAR包含org.springframework.orm.hibernate.HibernateTransactionManager?
- 12. 哪個JAR包含com.jaspersoft.mongodb.MongoDbConnection
- 13. 哪個Qt庫包含QApplication
- 14. 哪個dmp文件包含哪些表
- 15. VC++/Dev-C++:如何包含一個DLL?
- 16. 哪個yum組包含給定的包?
- 17. 哪個軟件包包含poly.transform()?
- 18. DLL包含在exe.file中?
- 19. 包含DLL的Qt構建
- 20. JPEG壓縮不包含DLL
- 21. 如何包含office dll?
- 22. Execv的Linux的printf不起作用
- 23. 使用execv在linux中使用'./'命令
- 24. 類型錯誤:execv()ARG 2必須只包含字符串
- 25. python subprocess和unicode execv()arg 2只能包含字符串
- 26. 我需要爲AzureActiveDirectoryLoginProvider和AzureActiveDirectoryExtendedLoginProvider包含哪些dll
- 27. Delphi 2010和Firebird - 需要包含哪些DLL以部署
- 28. 如何在visual studio 13中指定需要包含哪些dll
- 29. 如何創建一個dll,如包含圖標的shell32.dll
- 30. 如何在NuGet包中包含pinvoked dll?
我預計這個變化從系統到系統中。我認爲你需要重新考慮你的方法。 –
我的做法很好。 – biv
Linux沒有DLL,它有共享對象。你想要的是標準C庫,'libc.so' –