Linking problems with DLL
Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Visual C++ MFC Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=1583
Printed Date: 30 January 2025 at 11:38pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: Linking problems with DLL
Posted By: kkoster
Subject: Linking problems with DLL
Date 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?
|
Replies:
Posted By: abbasmsa
Date 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; }
|
|