Hello!
I have a dll library (AXACAC.dll) whuch was made in VS project. This dll exports one function:
__declspec(dllexport) void CreateRasterFile (const char *pszFormat, const char *pszDstFilename)
{}
And I try to import this function in the DDK sample - unidrv interface plug-in:
__declspec(dllimport) void CreateRasterFile (const char *, const char *);
In my src file I include my *.lib file as:
TARGETLIBS= ..\AXACAC.lib
But when I try to build DDK sample I have the following error:
error LNK2019: unresolved external symbol __imp__CreateRasterFile@8 referenced in function _OEMSendPage@4
..\..\i386\VPrinter.dll : fatal error LNK1120: 1 unresolved externals

Could you suggest something? May be you have ever had the same problems...

Recommended Answers

All 2 Replies

This is a long shot, but looks like name mangling to me.
Are these lines included in the header file of the DLL file?

#ifdef __cplusplus    // If used by C++ code, 
extern "C" {          // we need to export the C interface
#endif


....// Your header

#ifdef __cplusplus
}
#endif

This is a long shot, but looks like name mangling to me.
Are these lines included in the header file of the DLL file?

#ifdef __cplusplus    // If used by C++ code, 
extern "C" {          // we need to export the C interface
#endif


....// Your header

#ifdef __cplusplus
}
#endif

I have th following in my header file:

#ifdef __cplusplus   
extern "C" {          
#endif

#pragma once
#ifdef WIN_EXPORTSN
#define WIN_API __declspec(dllexport)
#else
#define WIN_API __declspec(dllimport)
#endif

WIN_API void CreateRasterFile (const char *, const char *);

#ifdef __cplusplus
}
#endif

But the problem still exists. I suppose it's because of compiler and linker flags. But it's only my opinion :(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.