==================================
// myMath.C.
// The myPuts function writes a null-terminated string to
// the standard output device.
#include <windows.h>
extern "C" __declspec(dllexport) void myPuts(LPTSTR lpszMsg);
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
if(ul_reason_for_call==DLL_PROCESS_ATTACH)
{
//TRACE0("DLL Initializing!\n");
}
else if(ul_reason_for_call=DLL_PROCESS_DETACH)
{
//TRACE0("DLL Terminating!\n");
}
return TRUE;
}
__declspec(dllexport) void myPuts(LPTSTR lpszMsg)
{
DWORD cchWritten;
HANDLE hStdout;
// Get a handle to the standard output device.
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
// Write a null-terminated string to the standard output device.
while (*lpszMsg)
WriteFile(hStdout, lpszMsg++, 1, &cchWritten, NULL);
}
============================
类似以上来编写,具体自己google吧。
编译器还是用gcc吧