Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - Linking problems with DLL
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Linking problems with DLL

 Post Reply Post Reply
Author
Message
kkoster View Drop Down
Newbie
Newbie


Joined: 23 December 2004
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote kkoster Quote  Post ReplyReply Direct Link To This Post Topic: Linking problems with DLL
    Posted: 23 December 2004 at 2:27pm
I have created an import lib, using LIB, from a DLL for which I don't have the source. The exports are as follows:

2    _Excel4
3    _Excel4v
4    _LPenHelper
1    _XLCallVer

There are 11 public symbols in the import lib:

4 _Excel4
5 _Excel4v
6 _LPenHelper
7 _XLCallVer
1 __IMPORT_DESCRIPTOR_XLCALL32
2 __NULL_IMPORT_DESCRIPTOR
4 __imp__Excel4
5 __imp__Excel4v
6 __imp__LPenHelper
7 __imp__XLCallVer
3 ⌂XLCALL32_NULL_THUNK_DATA

I declare the the function within an extern "C" block as:
__declspec(dllimport) int __stdcall Excel4v(int xlfn, LPXLOPER operRes, int count, LPXLOPER opers[]);

When I attempt to link the object files that are consuming this declaration I get the following linker error:

error LNK2019: unresolved external symbol __imp__Excel4v@16 referenced in function "public: static bool __cdecl XL::ExcelAddIn::abort(bool)" (?abort@ExcelAddIn@XL@@SA_N_N@Z)

The symbol appears to have an "@16" appended on it when it is formed in the C++ module where it is consumed.

Any constructive ideas on how to get around this?
Back to Top
abbasmsa View Drop Down
Newbie
Newbie


Joined: 15 May 2007
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote abbasmsa Quote  Post ReplyReply Direct Link To This Post Posted: 15 May 2007 at 12:31pm
On top of your source code, after the include statements, just add the following lines:

// dummy functions for XLCall32.lib
int far pascal Excel4v(int xlfn, LPXLOPER operRes, int count, LPXLOPER far opers[])
{
    return 1;
}
int far _cdecl Excel4(int xlfn, LPXLOPER operRes, int count,... )
{
    return 1;
}


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.