I'm new to c and c++. I'm a somewhat familiar with higher-level programming languages (python, c#). Just want to familiarize myself with low-level stuff (c, assembly etc). This is my attempt to compile dll that exports a function that should print string to the console. Unfortunately nothing is printed to the console.
#include <windows.h>
#include <stdio.h>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
__declspec(dllexport) void CALLBACK say_hello(void)
{
printf("Hello world!");
}
then I run dll with rundll32.exe .\say_hello.dll,say_hello
. It produces no errors, but also doesn't print the expected string.