#include #include int main(int argc, char *argv[]) { HMODULE mhellocli = LoadLibrary("hellocli.dll"); if (mhellocli == NULL) { printf("hellocli.dllをロードできません\r\n"); exit(1); } int(__cdecl * loaddll)(void); loaddll = (int(__cdecl *)(void))GetProcAddress(mhellocli, "loaddll"); if (loaddll() != 0) { printf("hellocs.dllをロードできません\r\n"); FreeLibrary(mhellocli); exit(1); } char *(__cdecl * methodc1)(const char *,const char *,char *); methodc1 = (char *(__cdecl *)(const char *,const char *,char *))GetProcAddress(mhellocli, "methodcli1"); char * buff00 = (char *)malloc(100); if (buff00 == NULL) { printf("malloc error\r\n"); FreeLibrary(mhellocli); exit(1); } const char * str01; if (argc >= 2) str01 = argv[1]; else str01 = "Hello world"; const char * str02; if (argc >= 3) str02 = argv[2]; else str02 = "ハローワールド"; memset(buff00,' ',99); * (buff00 + 99) = '\0'; printf("%s\r\n",methodc1(str01,str02,buff00)); char *(__cdecl * methodc2)(const char *,const char *,const char *,char *); methodc2 = (char *(__cdecl *)(const char *,const char *,const char *,char *))GetProcAddress(mhellocli, "methodcli2"); const char * str03; if (argc >= 4) str03 = argv[3]; else str03 = "グッドバイワールド"; memset(buff00,' ',99); * (buff00 + 99) = '\0'; printf("%s\r\n",methodc2(str01,str02,str03,buff00)); free(buff00); FreeLibrary(mhellocli); return 0; }