No functions in C# DLL with RGiesecke.DllExport

邮差的信 提交于 2019-12-01 05:41:27

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.

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.

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)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!