none
c语言怎样编译成DLL? RRS feed

  • 问题

  • c语言怎样编译成DLL,特别是引用#include "fltuser.h"后怎样编译,因为我发现执行#include "fltuser.h"后就编译不过了,用vc6.0去编译还是用WDK的build去编译呢?请帮帮忙!
    2010年10月1日 23:43

答案

  • 呃,什么编译错误?

    DLL为什么要用WDK编译?又不是驱动程序。



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年10月2日 2:47

全部回复

  • 呃,什么编译错误?

    DLL为什么要用WDK编译?又不是驱动程序。



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年10月2日 2:47
  • 我用VC6.0进行编译,将其放在first.c文件里面,代码如下

    #include <windows.h>
    //#include "fltuser.h"

    __declspec(dllexport) int add(int a, int b);

    BOOL APIENTRY DllMain( HANDLE hModule,
                           DWORD  ul_reason_for_call,
                           LPVOID lpReserved
          )
    {
        return TRUE;
    }

    int add(int a,int b)

    {

        return a+b;

    }

    如果不注释掉#include "fltuser.h",就提示:

    d:\work\mystrength\kernel\cdll3\fltuser.h(68) : fatal error C1083: Cannot open include file: 'fltUserStructures.h': No such file or directory

    因为fltuser.h里面有一段代码是 #include <fltUserStructures.h>

    如果我将其fltuser.h里面的代码改为 #include "fltUserStructures.h",又报错如下:

    d:\work\mystrength\kernel\cdll3\fltuserstructures.h(22) : fatal error C1012: unmatched parenthesis : missing ')'

    不知道应该如何解决,希望版主能够帮帮忙!

     

    2010年10月2日 12:10
  • 呃,创建一个fltuserstructure.c然后包含fltuserstructure.h,编译是否有同样错误?

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年10月2日 12:16
  • 我试过了,错误是一样的!是不是不能用vc6.0来编译?
    2010年10月2日 12:27
  • 那就是头文件的问题。unmatched parenthesis表示有语法错误,联系这个头文件的作者。

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年10月2日 12:31
  • 呵呵,这个头文件是我装了WDK产生的呀 作者应该是微软了!
    2010年10月2日 12:34
  • WDK的文件应该用DDKBuild编译,不要用VC。

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年10月2日 12:50
  • 求版主给一个例子吧 已经弄了很久了 都不能成功编译呀!
    2010年10月2日 20:08
  • WDK安装正常的话应该编译通过的。如果你的WDK编译不通过示例代码,卸载你的WDK之后重新安装。

    VC编译器不支持面向操作系统核心的驱动代码的编译。



    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    2010年10月2日 22:49