Help with importing .dll
-
I am a bit new at C++. I am trying to important various functions from a .dll file. I have both the .dll and the .lib files, and I know the function definition because they were previously imported in a Visual Basic project. How can I use the functions? For example, say I have the files x.dll and x.lib, which contain a function int z(int). What do I need to do use that function? The only method I found was using the __declspec(dllimport) int z(int);, and I am not even sure if that is correct since it gave me linking errors. Thanks in advance for your help. Kiernan
-
I am a bit new at C++. I am trying to important various functions from a .dll file. I have both the .dll and the .lib files, and I know the function definition because they were previously imported in a Visual Basic project. How can I use the functions? For example, say I have the files x.dll and x.lib, which contain a function int z(int). What do I need to do use that function? The only method I found was using the __declspec(dllimport) int z(int);, and I am not even sure if that is correct since it gave me linking errors. Thanks in advance for your help. Kiernan
kialmur wrote:
...I am not even sure if that is correct since it gave me linking errors.
Did you link with x.lib?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
kialmur wrote:
...I am not even sure if that is correct since it gave me linking errors.
Did you link with x.lib?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
I am not quite sure how. I tried adding it to the project and also added it in one of project settings under Linking. Is there some otherway?
kialmur wrote:
Is there some otherway?
There is, but if you are already adding it to the linker options, it's pointless. Exactly what linker error(s) are you getting?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
kialmur wrote:
Is there some otherway?
There is, but if you are already adding it to the linker options, it's pointless. Exactly what linker error(s) are you getting?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
The error is: error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z) For the linking portion, I went in the project settings, then to the Link tab. I added the path under Object/library modules. Is that correct?
-
The error is: error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z) For the linking portion, I went in the project settings, then to the Link tab. I added the path under Object/library modules. Is that correct?
kialmur wrote:
The error is: error LNK2001: unresolved external symbol "long __cdecl sendChipOffset(long,long,long)" (?sendChipOffset@@YAJJJJ@Z)
This is a name-mangling issue.
kialmur wrote:
Is that correct?
Yes.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb