DLL을 암시 적으로 C 콘솔 응용 프로그램에 연결할 수 없습니다. 나는 빈 DLL 프로젝트 하나 개 main.c 파일 포함 "라이브러리"를 만든 2008 년DLL 암시 적 연결
비주얼 스튜디오를 사용
__declspec(dllexport) int get_value()
{
return 123;
}
I main.c 파일로도 만들어 빈 콘솔 프로젝트 "CallingProgram"
__declspec(dllimport) int get_value();
void main()
{
int result = get_value();
}
"Linker \ Input \ Additional Dependencies"에 "Library.lib"를 추가했습니다.
그리고 여전히이 오류가 있습니다에서 LoadLibrary/GetProcAddress를 가진
error LNK2019: unresolved external symbol __imp__get_value referenced in function _main
내가 만든 테스트 된 DLL을 - 그것은 잘 작동합니다.
내가 DUMPBIN을 사용하여 Library.dll을 확인하고 또한 좋아 보인다 :
Microsoft (R) COFF/PE Dumper Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file library.dll
File Type: DLL
Section contains the following exports for Library.dll
00000000 characteristics
5340072C time date stamp Sat Apr 05 17:37:48 2014
0.00 version
1 ordinal base
1 number of functions
1 number of names
ordinal hint RVA name
1 0 00011109 get_value = @ILT+260(_get_value)
Summary
1000 .data
1000 .idata
2000 .rdata
1000 .reloc
1000 .rsrc
4000 .text
10000 .textbss
이 날이없는 것을 이해 도와주세요!
.lib 파일에 dumpbin.exe/all을 사용하여 포함 된 내용을 확인하십시오. 엉덩이에서 촬영, 나는 당신이 C + + 소스 코드 파일에서 DLL을 구축하고 C 프로그램에서 사용하려고합니다 것. 식별자 이름의 mangling을 억제하기 위해서는'extern "C"'가 필요하다. –
나는 dumpbin에서 나온 모든 정보를 어떻게 처리해야할지 모르겠다. 나는 extern "C"를 시도했다 - 그것은 도움이되지 않았다. – walruz
한숨. .dll 파일에서 dumpbin.exe/exports를 사용하면 질문에 대한 복사/붙여 넣기에 충분할만큼 짧습니다. –