Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extern "C" data import

Status
Not open for further replies.

abp

Programmer
Sep 14, 2000
134
0
0
FR
Hi All!

I am converting a "C" file to a C++ file for a project.
The file uses external functions definitions from a shared library(dll) which is built with C linkage. So when I converted this file to C++ I set the function declarations of these functions as extern "C". That is all fine, but there is a global data called "pdb_object *open_object" which is exported by the above dll. This is defined in a global file calld "pdb.glb". I have included this file
also with extern "C".

extern "C"
{
#include <pdb.glb>
}

and
#define DLLIMP __declspec(dllimport)

extern &quot;C&quot; DLLIMP pdb_object* open_object;

But what is happening is that, at build time the compiler is not able to resolve this global definition and gives an error.

Deneb2CgrMain.obj : error LNK2001: unresolved external symbol &quot;__declspec(dllimport) struct pdb_object * open_object&quot; (__imp_?open_object@@3PAUpdb_object@@A)

What is peculiar is that it is able to resolve most other data members imported from the dll similarly...

I did a dumpbin on the dll and I am able to see the definition for this particular symbol...

Thanks
Anand

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mail me at abpillai@excite.com if you want additional help. I dont promise that I can solve your problem, but I will try my best.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top