- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I have not posted in a while and am not sure that I am in the correct location to pose this question.
Regardless, I have been provided a DLL from which I want to invoke a function that is within the DLL.
I know the function name and the argument list.
I have declared the function.
No mater what I do, set DLL as a resource or go to TOOLS COMPILERS and add the directory to the list of places to look, I am constantly getting UNRESOLVED LINK.
Any help?
How can I get access to this DLL and the functions within this DLL?
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
If all you have is a DLL, you can't link to it. Linking requires a .LIB - for DLLs an "export .LIB" is created when the DLL is linked.
Since you don't have that, you have to dynamically load the DLL, get the address of the procedure and then call it. This is illustrated in the compiler_f\DLL\DynamicLoad sample that is part of the Intel Parallel Studio XE for Windows Sample Bundle (make sure you get the one for Windows.)
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Turns out that I do have the .LIB.
So, should I just put the .LIB in the same directory as the DLL?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I did put the appropriate .LIB in the folder and then through the TOOLS COMPILERS put the path into the X64 tab for Libraries and it still did not work. I am confused here why it cannot see the DLL nor the embedded function.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Just putting the .LIB in the folder doesn't do anything. You have to tell the linker to look in the .LIB. The easiest way to do that is to add the .LIB to your project as if it were a source file. An alternative is to give the name of the .LIB in the project property Linker > Input > Additional Dependencies.
I would not recommend modifying the Tools ... Compilers tab unless this is a location you want to use for all projects. Linker > General > Additional Library Directories is a place you can add project-specific paths.
The DLL itself needs to be in a place Windows will look for it. In the same folder as the EXE will work.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hello
The static library .lib associated with a dynamic library .dll contains for each function the necessary code to call to each of them.
It must be linked with the application and the .dll file is not required at this step.
At runtime, the .dll file must be in a location where the application can find it, in the same directory as the .exe is a common place. See Windows documentation to get information of search mechanism for .dll.
If you don't have the .lib file, call to .dll functions can be done using the loadlibray and getprocaddress functions. refer to the documentation of these functions.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Steve, thanks as always. I did end up adding as a dependency and the error has changed. Now, instead of saying it cannot find the function name, it is throwing that it cannot open an input file C:\PROGRAM.obj
Any clues?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Perhaps, you needed to put the full filename of your external library in quotes due to embedded spaces?
This looks suspiciously like the linker was passed this:
link foo.obj c:\program files (x86)\SomeDirectory\SomeOther\mylib.lib
and parsed the command line as having these files:
foo.obj
c:\program.obj
files.obj
(X86)\SomeDirectory\SomeOther\mylib.lib
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
thanks for the different input.
i have looked at the tips at the bottom of the properties as i move through the lists.
finally, or maybe not, i have the following error: unresolved...cannot open 'JHJHJH.lib'
any ideas?
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
It is not possible to tell you what to do if you report only the error messages without also reporting what steps you took earlier that may have caused those messages to be given.
For instance, the file name 'JHJHJH.lib' is not a random name. You must have typed it in into some Visual Studio setting, perhaps by mistake.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Attach a ZIP file with your .vfproj file and the buildlog.htm, from the Debug or Release folder after a failed build. This will let us see what you are doing.
