I know that this question has answer, but he does not help me. I saw articles: link and link, but I have problem. My code: C#: [DllExport("ServerOfDataBases", CallingConvention = CallingConvention.StdCall)] public static int ServerOfDataBases( string server, string user, string password, [MarshalAs(UnmanagedType.BStr)] out string strout) { string resultStr = String.Empty; // ... st
我知道这个问题有答案,但他不帮助我。 我看到文章:链接和链接,但我有问题。 我的代码: C#: [DllExport("ServerOfDataBases", CallingConvention = CallingConvention.StdCall)] public static int ServerOfDataBases( string server, string user, string password, [MarshalAs(UnmanagedType.BStr)] out string strout) { string resultStr = String.Empty; // ... strout = resultStr; return 0; } I
I'm trying to reference a C# DLL in my InnoSetup project. What I need is a simple function with one string parameter and a string return value. But even following the example and trying different kinds of marshaling I always end up in a Access Violation. This is my C# class : public class NKToolbox { [DllExport("EncryptPassword", CallingConvention.StdCall)] static string EncryptP
我试图在我的InnoSetup项目中引用C#DLL。 我需要的是一个带有一个字符串参数和一个字符串返回值的简单函数。 但即使遵循这个例子,并尝试不同种类的编组,我总是以Access Violation结尾。 这是我的C#类 : public class NKToolbox { [DllExport("EncryptPassword", CallingConvention.StdCall)] static string EncryptPassword([MarshalAs(UnmanagedType.LPStr)] string password) { File.WriteAllTex
I have a .Net Windows service. I want to create an installer to install that windows service. Basically, it has to do the following: Pack installutil.exe (Is it required?) Run installutil.exe MyService.exe Start MyService Also, I want to provide an uninstaller which runs the following command: installutil.exe /u MyService.exe How to do these using Inno Setup? You don't need ins
我有一个.Net Windows服务。 我想创建一个安装程序来安装该Windows服务。 基本上,它必须做到以下几点: 安装包installutil.exe (是否需要?) 运行installutil.exe MyService.exe 启动我的服务 另外,我想提供一个运行以下命令的卸载程序: installutil.exe /u MyService.exe 如何使用Inno Setup来完成这些操作? 您不需要installutil.exe ,可能您甚至无权重新分配它。 以下是我在应用程序中执行此操作的方
This question already has an answer here: Can a .NET windows application be compressed into a single .exe? 12 answers What you are describing is a static library, not a DLL. If C were a static library, then when you compile A (with the compiler set to drop unused stuff), A's exe will have all code required by A taken from the static library C and put directly into the exe. The same wo
这个问题在这里已经有了答案: .NET的Windows应用程序可以压缩成一个.exe文件吗? 12个答案 你所描述的是一个静态库,而不是一个DLL。 如果C是一个静态库,那么当你编译A(编译器设置为放弃不使用的东西)时,A的exe将获得A所需的所有代码,这些代码来自静态库C并直接放入exe。 B也是一样。 但这不是DLL的工作方式。 使用DLL时,A正在从C获取某些代码的“服务”,但由于代码以C存在,因此A无法控制C中的代码。 正如@
I've got a function which needs to get path to a dll file for running them. To make use of my app easier I don't want to let the user type in path for dll file. I added dll file as ressource already but my methode needs to get the path to the .dll file as string. How to get the string of my dll file called "test2.dll"? All I found was about the use of functions from .dll fil
我有一个函数需要获取路径来运行它们的dll文件。 为了更方便地使用我的应用程序,我不想让用户键入dll文件的路径。 我已经将dll文件添加为资源,但是我的方法需要以字符串的形式获取.dll文件的路径。 如何获得我的dll文件的字符串称为“test2.dll”? 我发现的所有内容都是关于程序本身使用.dll文件中的函数,但并未加载包含.dll的路径。 string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Loca
I have an application environment that is essentially a plug in where: host application calls into unmanaged c++ dll which calls into managed C++ dll which calls into C# dll This is a fairly known way of calling into C# from unamanaged C++ by using a bridge of managed C++. This all works well and good under most circumstances except in a plug in type architecture where my dlls(unmanaged C++,
我有一个应用程序环境,基本上是一个插件,其中: 主机应用程序调用到非托管c + + dll调用托管c + + dll调用到C#dll 这是通过使用托管C ++桥从非托管C ++调用C#的一种相当已知的方式。 在大多数情况下,除非插件式体系结构中的dll(非托管C ++,托管C ++和C#)与调用dll的应用程序不在同一目录中,否则这一切都可以正常工作。 当应用程序调用非托管C ++时,一切都很好,因为应用程序知道要调用的目录来加载该dll。 然
I have C# application which loads set of managed assemblies. One of this assemblies loads two native dlls (each of them in different location) if they are avaiable. Iam trying to find way to provide search path to those native dlls. Are there other options? I really dont want to provide those dlls with my software - copying them to programs directory of course solves the problem. I've
我有加载一组托管程序集的C#应用程序。 如果这些程序集可用,则其中一个程序集将加载两个本地dll(每个dll位于不同位置)。 Iam试图找到方法为这些本地dll提供搜索路径。 还有其他选择吗? 我真的不想提供这些DLL与我的软件 - 复制到程序目录当然解决了这个问题。 我尝试过使用SetDllDirectory系统函数,但可以只提供一个使用它的路径。 每次调用此函数都会重置路径。 设置PATH环境变量也不能解决问题:/ 这可以帮
I want to load an assembly (its name is stored in a string), use reflection to check if it has a method called "CustomType MyMethod(byte[] a, int b)" and call it or throw an exception otherwise. I guess I should do something like this, but would appreciate if someone could offer same advice on how best to do it: Assembly asm = Assembly.Load("myAssembly"); /* 1. does it matter if write
我想加载一个程序集(其名称存储在一个字符串中),使用反射来检查它是否有一个名为“CustomType MyMethod(byte [] a,int b)”的方法,然后调用它或抛出异常。 我想我应该做这样的事情,但是如果有人能够就如何做到这一点提供相同的建议, Assembly asm = Assembly.Load("myAssembly"); /* 1. does it matter if write myAssembly or myAssembly.dll? */ Type t = asm.GetType("myAssembly.ClassName"); // specify paramete
I am currently trying to get the CUDA part of EMGU CV working. After the compilation, when I try to run it, I get the error "Unable to find an entry point named 'cudaCreateLinearFilter' in DLL 'cvextern'. Where cudaCreateLinearFilter can be arbitrarily replaced by any CUDA-related function within EMGU CV. EMGU CV itself works fine tough. I tried the fix described here and
我目前正试图让EMGU CV的CUDA部分工作。 编译完成后,当我尝试运行它时,出现错误“无法在DLL'cvextern'中找到名为'cudaCreateLinearFilter'的入口点。其中cudaCreateLinearFilter可以被EMGU CV中任何与CUDA相关的函数任意替换。EMGU CV本身工作很好。 我尝试了此处所述的修复,并将所有提到的dll(如cudart64_32_16.dll和opencv_calib3d220.dll)复制到项目中的Debug文件夹中。 不幸的是,这也没有奏效。
I have a bit of my game which looks like this: public static float Time; float someValue = 123; Interlocked.Exchange(ref Time, someValue); I want to change Time to be a Uint32; however, when I try to use UInt32 instead of float for the values, it protests that the type must be a reference type. Float is not a reference type, so I know it's technically possible to do this with non-referen
我有一些看起来像这样的游戏: public static float Time; float someValue = 123; Interlocked.Exchange(ref Time, someValue); 我想改变时间是一个Uint32; 但是,当我尝试使用UInt32而不是float作为值时,它会抗议该类型必须是引用类型。 Float不是一个引用类型,所以我知道在非引用类型中做到这一点在技术上是可行的。 有什么实际的方法来使这个UInt32工作? 虽然丑陋,但实际上可以使用unsafe C#代码对枚举或其他可