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

Greg Boone greg.boone at autodesk.com
Fri Apr 12 06:57:44 PDT 2013

What are your linker settings? Do you link to fdo.lib and fdocommon.lib?

If that is not the issue, try and remove all use of DECLDIR and see if that resolves the linker issue.

-----Original Message-----
From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of nav
Sent: Friday, April 12, 2013 2:45 AM
To: fdo-users at lists.osgeo.org
Subject: [fdo-users] Using FDO in a Windows DLL causes unresolved symbol errors

*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 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:*
#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 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;

    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.
fdo-users mailing list
fdo-users at lists.osgeo.org

More information about the fdo-users mailing list