有谁知道RGiesecke.DllExport到底是什么东西?
怎么用的,到底是什么原理啊?
不是说原生不支持导出的吗?
在加了一个第三方库之后
[DllExport()]到底干了什么?
[/code]using System;
using System.Collections.Generic;
using System.Linq;
using RGiesecke.DllExport;//关键是这个第三方库,到底怎么搞的?
using System.Runtime.InteropService
using System.Threading;namespace Demo
{
    static class Program
    {
        static Int32 AuthCode;        [return: MarshalAs(UnmanagedType.LPStr)]
        [DllExport()]
        public static String AppInfo() {
            return "9,wtf.demo.echo";
        }        [DllExport()]
        public static Int32 Initialize(Int32 authCode)
        {
            AuthCode = authCode;
            return 0;
        }        [DllExport()]
        public static Int32 eventStartup()
        {
            NativeMethods.CQ_addLog(AuthCode, 10, "什么鬼", "你好,这里是木馨!");
            return 0;
        }        [DllExport()]
        public unsafe static Int32 eventPrivateMsg(Int32 subType, Int32 sendTime, Int64 fromQQ, [MarshalAs(UnmanagedType.LPStr)] String message, Int32 font)
        {
            string x = message;
            ThreadPool.QueueUserWorkItem(delegate(Object _)
            {
                NativeMethods.CQ_sendPrivateMsg(AuthCode, fromQQ, x);
            });
            return 0;
        }    }
}

解决方案 »

  1.   

    bing搜索一下这个dll
      

  2.   

    可以反汇编之后重新编译
    不过用C++/CLI就可以做的事情为啥要用没有经过广泛测试的第三方库?
      

  3.   

    C#? 标准 win32动态链接库?你在逗我
      

  4.   

    NUGET上就有, 不光光只是引用这个DLL的,你还要装VS插件的,然后还要改写项目的工程配置,才行的,
    这个麻烦的很,不建议用这个
    楼主说的那个插件是可以导出标准的DLL,他相当于把C# 的DLL打包重新封装成C++的DLL了 然后暴露出C++的函数。在EasyHook上就有用到这个东西 
      

  5.   

    这一类的教程真的是非常的少 .Only static methods can be exported.看样子只支持静态类 静态方法的 导出 . 不过这功能也很不错了.很强大.至于我楼上说的EasyHook ,其实是另外一种实现原理了,我也研究了一下,大致测试成功了.EasyHook 和 DllExport 都是可以解决C#远程钩子注入的方法.
    各有优缺点吧.有空我抽时间整理资料发一篇教程吧.