Debug c++ dll in C#

If I understand you correctly, you want to debug a C++ coded DLL that you created, in a C# project that calls the DLL, which you also created? I’ve done this before by going into your C# project properties, and under the Debug section, checking the “Enable unmanaged code debugging” check box. This should allow … Read more

How to export a C++ class from a dll? [duplicate]

A common approach is to have a single macro (let’s call it EXPORT) which either expands to dllimport or dllexport depending on whether some sort of “building the DLL right now” define is set, like this: #ifdef MAKEDLL # define EXPORT __declspec(dllexport) #else # define EXPORT __declspec(dllimport) #endif class EXPORT xyz { // … }; … Read more

Win32 API to enumerate dll export functions?

dumpbin /exports is pretty much what you want, but that’s a developer tool, not a Win32 API. LoadLibraryEx with DONT_RESOLVE_DLL_REFERENCES is heavily cautioned against, but happens to be useful for this particular case – it does the heavy lifting of mapping the DLL into memory (but you don’t actually need or want to use anything … Read more

C# Putting the required DLLs somewhere other than the root of the output [duplicate]

Amazing answers so far. None right 😉 Well, yes, you can put the assemblies in separate locations. In the corresponding application config (app.config which gets copied to your.exe.config) add: <runtime> <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″> <probing privatePath=”lib” /> </assemblyBinding> </runtime> According to: http://msdn.microsoft.com/en-us/library/823z9h8w.aspx This will make the program look into the private path (folders under it’s own folder) … Read more

Creating a .dll file in C#.Net

You need to make a class library and not a Console Application. The console application is translated into an .exe whereas the class library will then be compiled into a dll which you can reference in your windows project. Right click on your Console Application -> Properties -> Change the Output type to Class Library

Embedding assemblies inside another assembly

ILMerge does merge assemblies, which is nice, but sometimes not quite what you want. For example, when the assembly in question is a strongly-named assembly, and you don’t have the key for it, then you cannot do ILMerge without breaking that signature. Which means you have to deploy multiple assemblies. As an alternative to ilmerge, … Read more

A Simple C# DLL – how do I call it from Excel, Access, VBA, VB6?

You can’t access a static member via COM interop. In fact your code doesn’t even compile, the method should be in a class. Here is how you can do it: [InterfaceType(ComInterfaceType.InterfaceIsDual)] [Guid(“01A31113-9353-44cc-A1F4-C6F1210E4B30”)] //Allocate your own GUID public interface _Test { string HelloWorld { get; } } [ClassInterface(ClassInterfaceType.None)] [Guid(“E2F07CD4-CE73-4102-B35D-119362624C47”)] //Allocate your own GUID [ProgId(“TestDll.Test”)] public class … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)