Mangled static library entry points

G

Greg Fuller

I'm trying to port a library originally written for unix to Windows.
After a bit of work I've finally gotten it to compile and create the
..lib

For the purposes of example, let's say the .lib contains the functions
"foo", "fooey" and "foolish". When I create a test program and try
linking it to the .lib, I get:

error LNK2001: unresolved external symbol _foo testlib.obj
error LNK2001: unresolved external symbol _fooey testlib.obj
error LNK2001: unresolved external symbol _foolish testlib.obj
etc...

Why is it putting an underscore in front of all the function names?

Thanks!
-Greg
 
P

Pavel Minaev

Greg Fuller said:
I'm trying to port a library originally written for unix to Windows.
After a bit of work I've finally gotten it to compile and create the
.lib

For the purposes of example, let's say the .lib contains the functions
"foo", "fooey" and "foolish". When I create a test program and try
linking it to the .lib, I get:

error LNK2001: unresolved external symbol _foo testlib.obj
error LNK2001: unresolved external symbol _fooey testlib.obj
error LNK2001: unresolved external symbol _foolish testlib.obj
etc...

Why is it putting an underscore in front of all the function names?

It's the standard mangling convention for "cdecl" (i.e. default calling
convention) functions, both on Unix and on Windows.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top