Jump to content
  • Advertisement
Sign in to follow this  
dotproduct

DLL plugin linking problems

This topic is 4706 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

plugin.h:
#include "common.h"

#include <iostream>

class PLUGIN_API plugin : public common
{
public:
	plugin();
	void printPlugin();
};

common.h:
#ifdef PLUGIN
#define MAIN_API __declspec( dllimport )
#define PLUGIN_API __declspec( dllexport )
#else
#define MAIN_API
#endif

class MAIN_API common
{
public:
	common();
	void print();
}; 

plugin.cpp:
#include "plugin.h"

plugin::plugin()
{
}

void plugin::printPlugin()
{
	std::cout << "Hello from plugin" << std::endl;
        common::print();

}

Now... how can I compile this plugin into a DLL without getting linker errors about unresolved symbols common::common() and common::print() ? Or is this impossible? do I _have_ to link with the import library containing the "common" class? This is using the Visual Studio 2003 command line tools. (cl + link) Error crap: link /nologo /INCREMENTAL /dll /out:plugin.dll /implib:plugin.lib plugin.obj Creating library plugin.lib and object plugin.exp plugin.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) pu blic: __thiscall common::common(void)" (__imp_??0common@@QAE@XZ) referenced in f unction "public: __thiscall plugin::plugin(void)" (??0plugin@@QAE@XZ) plugin.dll : fatal error LNK1120: 1 unresolved externals

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by dotproduct
do I _have_ to link with the import library containing the "common" class?


Looks that way to me.

Share this post


Link to post
Share on other sites
Yes, you need common's implementation to be available, otherwise the linker will miss information about the common subobject on the plugin object.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!