No functions in C# DLL with RGiesecke.DllExport

I am trying to make a DLL in C# for use in a couple other languages. I found RGiesecke's DllExport but it doesn't seem to work. It builds just fine and makes a dll, but when I open it in Dependency Walker it doesn't show any functions, and my calling code can't find them either.

I created a new "Class Library" project (VS 2013) and then installed "Unmanaged Exports (DllExport for .Net)" from NuGet. Are there any project settings I need?

Here is my code.

using System;
using System.Collections.Generic;
using System.Text;
using RGiesecke.DllExport;

namespace ToolServiceDLL
{
    public class Class1
    {
      [DllExport("addUp", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
      public static double addUp(double num1, double num2)
      {
        return num1 + num2;
      }

      [DllExport("get5", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
      public static int get5()
      {
        return 5;
      }
    }
}

I found the problem. It has it in the RGiesecke Documentation, but I missed it. In the project settings->Build->Platform target: you can not have it set to "Any CPU". You must have it set to x64 or x86 depending on if you want to use it in a a 64 or 32 bit application.

No functions in C# DLL with RGiesecke.DllExport, I am trying to make a DLL in C# for use in a couple other languages. I found RGiesecke's DllExport but it doesn't seem to work. It builds just fine and makes a dll,� The .dll builds fine and the CPU match (x86), but the unmanaged program can't get the export function address once the c# dll has been loaded. Its pretty basic right now, but I'm just trying to get it to work. I'll need the imports later on. Any help please, the documentation for the nuget package is quite thin. Thanks

I had a similar problem, but had already set the platform target to x64 and had the following error:

The name 'CallingConvention' does not exist in the current context

I found adding the using directive System.Runtime.InteropServices resolve the problem.

C# unmanaged DLL Export / Import in C++, Consume Managed C# DLL from Unmanaged C++ EXE - Cannot start the The error you reported states the linker is looking for the function export with You can not do the way you are doing now. Text; using RGiesecke. No functions in C# DLL with RGiesecke.DllExport. 4. Passing data between Python and C# without writing a file. 0. How to call a C# code from python. 2.

This is a good question and worked for me. Just took a bit more time than it should due to the Python side where I made a mistake. Here is the working code in Python3 import sys import clr sys.path.insert(0,'C:\\your_path\\Py2NetComm\\bin\\Debug') clr.AddReference("Py2NetComm") import ToolServiceDLL as p2n ret = p2n.Class1.addUp(2,3) print("addUp:", ret)

DllExport not creating an entry point - c# - csharp, DllExport not creating an entry point - c#. InteropServices; using RGiesecke. NET project that loads TestApi.dll and invokes an exported DLL function The� Yes, it is possible to export functions from a C# dll in much the same way that C++ does it! You need a little help from an add-in Unmanaged Exports (DllExport for .Net) that facilitates this process, or from a similar method such as Exporting functions in C#/VB.NET to native code.

RGiesecke dll Export template - c# - csharp, RGiesecke dll Export template - c#. if I try to register the dll with Regsvr32 I get and error telling me there is no dll entry point. I don't C# Dll - export functions. A set of compile-time libraries (nothing to deploy) and a build task that enable you to export functions from managed code to native applications. That means, you can create plugins in a managed language like C# or F# for native applications that only have a C-Api (like Notepad++). The nuget package is all you need. Just mark your methods with [DllExport] and build for x86, x64 or ia64. Hints

DllExport 1.7.3, Quick start: https://github.com/3F/DllExport/wiki/Quick-start Examples. Unmanaged C++ / C# / Java: https://youtu.be/QXMj9-8XJnY 🧪 Demo:� The C# Dll Code runs well without errors and creats me a AddDll.lib and AddDll.dll file. I would like to import this Dll in C++: // CallAdd.h #pragma once #define DllImport __declspec(dllimport) namespace AddDll { class MyAddDll { public: static DllImport double Add(double a, double b); }; }

Call C# DLL from C++ application, object of abstract class type 'ManagedDLL::ICalculator' is not allowed Class1 using System; using RGiesecke. My C# dll function is static and declared as: [ DllExport(ExportName = "GetNumber", CallingConvention = CallingConvention. Fixes to the .lib creation (export names had the real method name in the .lib, not the one that DllExport contained, while the DLL itself exported it correctly) nicer Icon TargetFramework is no longer set to 3.5 but left empty for the IDE to decide what makes sense (VS2005 obviously has no clue about this setting).

Comments
  • It does not create a DLL, it modifies a DLL. So that did not happen. One nasty trap is that the Nuget package will not install correctly when you don't run VS elevated, failure is silent. Right-click the VS shortcut and select "Run as Administrator".
  • I am running as Admin, and it shows "RGiesecke.DllExport.Metadata" in the References. How do I tell if it tries to modify the dll?