Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - DMC not exporting handles from DLL
I'm using DMC 8.40 on Win98 SE. Windows handles (HWND, HINSTANCE, ...) not exported from DLL. Sample code is: // ------------------------------------------------ // Nothing.h // ------------------------------------------------ #include <windows.h> #ifdef CMPDLL #define EXPALL __declspec(dllexport) #define EXPVAR __declspec(dllexport) extern #else #define EXPALL __declspec(dllimport) #define EXPVAR __declspec(dllimport) extern #endif EXPVAR HWND NoExp; // Not exported with DMC EXPVAR int ExpOk; // Exported OK EXPALL int FunOk(long x); // Exported OK // ------------------------------------------------ // Nothing.cpp // ------------------------------------------------ #include "Nothing.h" BOOL WINAPI DllMain(HINSTANCE h,DWORD d, LPVOID p) {return TRUE;} EXPALL HWND NoExp = 0; EXPALL int ExpOk = 0; EXPALL int FunOk(long x) {NoExp=(HWND)x; return ++ExpOk;} // ------------------------------------------------ // Client.cpp // ------------------------------------------------ #include <stdio.h> #include "Nothing.h" int main() { printf("DMC DLL Test\n\n"); printf("FunOk(10) returns: %d\n", FunOk(10)); printf("NoExp = %ld ExpOk = %d\n", NoExp, ExpOk); printf("Altering NoExp to 20 and ExpOk to 2\n"); NoExp = (HWND)20; ExpOk = 2; printf("NoExp = %ld ExpOk = %d\n", NoExp, ExpOk); printf("FunOk(30) returns: %d\n", FunOk(30)); printf("NoExp = %ld ExpOk = %d\n", NoExp, ExpOk); printf("\n\nPress Enter to quit:"); getchar(); return (0); } // ------------------------------------------------ // DMC Command Line // ------------------------------------------------ Building DLL / Compiler output:dmc -oNothing.dll -L/implib -WD -mn -DCMPDLL Nothing.cpp kernel32.lib user32.lib gdi32.lib May 21 2004
The fix for this will go out in the next update. Thanks, -Walter May 22 2004
|