[fdo-users] Using FDO in a Windows DLL causes unresolved symbol errors

nav navin.pro at gmail.com
Thu Apr 11 23:44:32 PDT 2013


*I was trying to get the sample FDO code into a DLL, but ran into some
unresolved symbol errors and had no way to resolve it. Could you help? Code
below.*

*The error is: *
Error	1	error LNK2019: unresolved external symbol "__declspec(dllimport)
public: static class IProviderRegistry * __cdecl
FdoFeatureAccessManager::GetProviderRegistry(void)"
(__imp_?GetProviderRegistry at FdoFeatureAccessManager@@SAPAVIProviderRegistry@@XZ)
referenced in function "public: int __thiscall
FDODataConnection::RegisterProvider(void)"
(?RegisterProvider at FDODataConnection@@QAEHXZ)
F:\Projects\DatabasePlugin\DatabasePlugin.obj	DatabasePlugin


*The header:*
#ifndef _DATABASEPLUGIN_H_
#define _DATABASEPLUGIN_H_
#if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif

#include "Fdo\ClientServices\ProviderRegistry.h"
#include "Fdo\ClientServices\ConnectionManager.h"
#include "Fdo\Connections\IConnection.h"			
#include "Fdo\Connections\IConnectionPropertyDictionary.h"
#include "Fdo\Connections\IConnectionInfo.h"
#include "Fdo\ClientServices\FeatureAccessManager.h"
#include <exception>
#include <iostream>
#include <Windows.h>

// Specify "C" linkage to get rid of C++ name mangling
extern "C"
{
class FDODataConnection
{
	FdoPtr<FdoProviderRegistry> m_pRegistry;
public:
    FDODataConnection() {}
    ~FDODataConnection() {}
	int RegisterProvider();strPassword,std::string strService,std::string
strDataStore);
};

FDODataConnection* objConnection;
	
DECLDIR int Connect();
}//extern "C"

#endif // End the inclusion guard

*The cpp:*
#define DLL_EXPORT// DECLDIR will perform an export for us
#include "DatabasePlugin.hpp"// Include our header, must come after #define
DLL_EXPORT

extern "C" // Get rid of name mangling
{

//==============================================================================
//============================ FDO functions below
=============================
//==============================================================================
int FDODataConnection::RegisterProvider()
{
	FdoPtr<FdoProviderRegistry> m_pRegistry =
(FdoProviderRegistry*)FdoFeatureAccessManager::GetProviderRegistry();

    return 1;
}//RegisterProvider

    DECLDIR int Connect()
    {
        objConnection = new FDODataConnection();
        int nProviders = objConnection->RegisterProvider();
        return 0;
    }//Connect

}//extern

*I can't keep the FDO include's within extern "C" because the templates in
the headers can't be C based.*




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-FDO-in-a-Windows-DLL-causes-unresolved-symbol-errors-tp5046281.html
Sent from the FDO Users mailing list archive at Nabble.com.


More information about the fdo-users mailing list