here's the dumb way to do it :D,
const uint8_t dll_data[] = { /* dump the raw dll file data here */ };
typedef int (*SquareFn)(int);
int main()
{
// create a dll file from the above dll_data
HANDLE hFile = CreateFileA("a.dll", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD written;
BOOL writeResult = WriteFile(hFile, dll_data, sizeof(dll_data), &written, NULL);
CloseHandle(hFile);
HMODULE hModule = LoadLibraryA("a.dll");
SquareFn square = (SquareFn)GetProcAddress(hModule, "square");
int result = square(5);
FreeLibrary(hModule);
DeleteFileA("a.dll"); // Delete the temp file
printf("Function result: %d\n", result);
return 0;
} the fun.c file which i create a dll out of,
__declspec(dllexport) int square(int num)
{
return num * num;
}