I am naive about the assemble/link process, so when I get messages like:



test.obj: error LNK2001: unresolved external symbol _PacketOpenAdapter@4
test.exe: fatal error LNK1120: 1 unresolved externals


what is this saying? What does "symbol" and "external" refer to?
Just some general info on this topic would be helpful.
Posted on 2002-10-07 11:40:37 by rdaneel
Looks like you miss to link a required library...
Posted on 2002-10-07 11:58:22 by JCP
It is a vital part of modern programming to modularise the process, by this I mean that there will be code beyond the object file that the compiler / assembler does not see. These are extenals, so called because they are outside the body of compiled code.

At link time, all the necessary libs and objs will be mashed together to form the final executable, so when you've got your object with its externally defined function, at link time, the linker will find that function and fix it so your object uses the provided bit of code.

This can cause two problems, one where it cannot decide between two (or more) identically named external functions, and the other where it cannot any!
An unresolved external - linker error is the latter. Basically you've tried to use a function, and not provided a library or object which has that name.

The "@4" signifies that it takes 32 bits of data as an argument (i.e. there is a line somewhere in your code that looks like: "PacketOpenAdapter PROTO : DWORD" ).

Mirno
Posted on 2002-10-07 12:08:01 by Mirno
So if I have included the header and library:



include \masm32\include\packet.inc

includelib \masm32\lib\packet.lib


and I know from a hex search that packet.lib contains a reference to _PacketOpenAdapter
in it, does that mean that the prototype declaration is wrong? Maybe :DWORD is the wrong
argument type?
Posted on 2002-10-07 12:23:58 by rdaneel