[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

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

*The header:*
#if defined DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#define DECLDIR __declspec(dllimport)

#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;
    FDODataConnection() {}
    ~FDODataConnection() {}
	int RegisterProvider();strPassword,std::string strService,std::string

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

extern "C" // Get rid of name mangling

//============================ FDO functions below
int FDODataConnection::RegisterProvider()
	FdoPtr<FdoProviderRegistry> m_pRegistry =

    return 1;

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


*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