Jump to content

Linking errors for model DLL using SystemC DLL


Recommended Posts

Hi all,

I'm trying to create a DLL for a simple SystemC model using Microsoft Visual C++ 2019.

After building SystemC DLL (DebugDLL) and following MS doc to create a DLL, I'm having linking errors like:

1>   Creating library <path>\SimpleLib\Debug\SimpleLib.lib and object <path>\simple\SimpleLib\Debug\SimpleLib.exp
1>SimpleLib.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sc_core::sc_module_name::~sc_module_name(void)" (__imp_??1sc_module_name@sc_core@@QAE@XZ) referenced in function "public: __thiscall myclass::myclass(class sc_core::sc_module_name)" (??0myclass@@QAE@Vsc_module_name@sc_core@@@Z)
1>SimpleLib.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sc_core::sc_simcontext::sc_simcontext(void)" (__imp_??0sc_simcontext@sc_core@@QAE@XZ) referenced in function "class sc_core::sc_simcontext * __cdecl sc_core::sc_get_curr_simcontext(void)" (?sc_get_curr_simcontext@sc_core@@YAPAVsc_simcontext@1@XZ)

(attached complete log)

What could be the problem?


The code is the one from the post link:

// SimpleLib.h

#pragma once

#define SIMPLELIB_API   __declspec(dllexport)
#define SIMPLELIB_API   __declspec(dllimport)

#include <systemc.h>

class SIMPLELIB_API myclass : public sc_core::sc_module
    myclass(sc_core::sc_module_name name);
    void display();



#include "pch.h" // use stdafx.h in Visual Studio 2017 and earlier
#include "SimpleLib.h"

myclass::myclass(sc_core::sc_module_name name) : sc_core::sc_module(name)
    std::cout << "Inside cons\n";
void myclass::display()
    std::cout << "Calling display\n";

Configuration of the SimpleLib project was done also following INSTALL (Building against a SystemC DLL):

  C/C++ -> General -> Additional Include Directories is set to: <my_path>\systemc-2.3.3\src

  Added SC_WIN_DLL to: C/C++ -> Preprocessor -> Preprocessor Definitions

  Linker -> General -> Additional Library Directories is set to:  <my_path>\systemc-2.3.3\msvc10\SystemC\DebugDLL


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...