// VCDLLCallTest2.cpp : コンソール アプリケーションの // エントリ ポイントを定義します。 // #include "stdafx.h" #include typedef int ( *FUNC_MYADD )( int a, int b ); int _tmain( int argc, _TCHAR* argv[] ) { HMODULE dll = LoadLibrary( L"VCDLLTest.dll" ); if ( dll == NULL ) { printf( "LoadLibrary Error=%d\n", GetLastError() ); return 1; } FUNC_MYADD func = ( FUNC_MYADD )GetProcAddress( dll, "myAdd" ); if ( func == NULL ) { printf( "GetProcAddress Error=%d\n", GetLastError() ); return 2; } int ret = func( _wtoi( argv[1] ), _wtoi( argv[2] ) ); printf( "ret=%d\n", ret ); FreeLibrary( dll ); return 0; }