getProcAddress - NULL zurückgegeben

Ich habe den folgenden code:

  //mydll.cpp
    #include <Windows.h>
    #include <io.h>

    #define STDOUT_FILEDESC 1

    class MYSTDOUT {
        bool shouldClose;
        bool isBuffered;
    public:
        MYSTDOUT(bool buf = true, bool cl = true) 
            : isBuffered(buf),
              shouldClose(cl) 
        {}
        ~MYSTDOUT() {
            if (shouldClose) {
                close(STDOUT_FILEDESC);
            }
        }
    };

    __declspec(dllexport) void* mydll_init_stdout()
    {
        static MYSTDOUT outs;
        return &outs;
    }
//test_dll.cpp
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <io.h>


typedef void* (__cdecl *MYPROC)(void);


int main(void)
{
  int fd;
  void *pstdout;

  MYPROC init_stdout;
  HMODULE handle = LoadLibrary(TEXT("mydll.dll")); 

  init_stdout = (MYPROC)GetProcAddress(handle,"mydll_init_stdout");//NULL

  FreeLibrary((HMODULE) handle);
  return 0;
}

Ich, dass init_stdout NULL ist.Was ein problem sein könnte?
Griff ist OK(Nicht NULL)
Danke

InformationsquelleAutor Yakov | 2012-04-20
Schreibe einen Kommentar