Link error 2001 and 1120 
Author Message
 Link error 2001 and 1120

Please help..!!
This is driving me crazy. Nothing that I do seems to be able to fix this
problem:

I built a DLL, in another environment, It works very well in its own
environment.

I need to integrate it into a VC project.
I used the lib program to generate the .lib and .exp files from the .def
file.
A dump of them shows that my function exists unmangled as it should in
both.
The prototype and function call below are from the VC source file that I
have
been trying to get to link. The VC linker errors are below that..

It's pretty obvious from the snippets below that extern "C" does NOT
turn off
name manging in VC 5.
Why ?
Is there a switch that will override extern "C"..??
Is this some sort of grotesque BUG..???

More to the point, if extern C cannot be relied upon to make this link
possible,
how is it possible to get VC and any other environment to cooperate.??

// Prototype --------------------------------------------

extern "C"
{
        void __declspec(dllexport) WINAPI InvokeProcsDialog( void );

Quote:
}

// function call -----------------------------------

                InvokeProcsDialog();

// Linker error -----------------------------------------
Linking...
VCtestProc.obj : error LNK2001: unresolved external symbol

Debug/VCtestProc.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

VCtestProc.exe - 2 error(s), 0 warning(s)



Sat, 21 Oct 2000 03:00:00 GMT  
 Link error 2001 and 1120

You can't turn of the "mangling".  Most products in the 32bit world rely on
the _stdcall calling convention (thats what WINAPI defines to),
unfortunately this is not a standardized convention.  Even MS disagrees with
itself on how it should work.

The short answer is that you can't get VC++ to directly import the function
and use it, instead you will have to use LoadLibrary & GetProcAddress in
order to call the function.  This means you will not use the header or link
to the .lib file.

--
Is there another word for synonym?

 ---------------------------------------------------------------------------
---
| Author for Pinnacle Publishing "Visual C++ Developer"
http://www.pinpub.com/ |
| http://lucifer.lotus.com/jim/main.htm
|
 ---------------------------------------------------------------------------
---



Sat, 21 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Errors 2001 and 1120 linking import library

2. BeginnerQuestion -> LinkerError 2001 and 1120

3. link 2001 error in statically linked mode only

4. link 2001 error when statically linking

5. vs.net + lnk2019 error +lnk 1120 error

6. Error LNK2001 Fatal error 1120

7. Linking Error 2001

8. Link Error 4006,4008,2001

9. Link 2001 Errors and Class Wizard Problem

10. Help-Linking Error 2001

11. Linking Error 2001

12. Link Error 2001 for...

 

 
Powered by phpBB® Forum Software