Jump to content

odd behavior when linking multiple libraries using libsystemc.so


Recommended Posts

I get odd behavior when I link 2 independent DLLs that both require systemc to my program.

In the first DLL are a bunch of Utility code that is used in my project along with a default sc_main (Call this Utils)

In the second are user specific systemc code (call this User)

Both are compiled linking to libsystemc.so

In the program file which is the top frame work I link both User and Utils.

First observation:

  • Order matters. If User is imported before Utils then sc_main is not found.
    • This makes sense since sc_main lives in Utils
  • all wire/binding done in the User code are not properly registered (this assumes Utils is imported prior to User)
    • Generally the User code gets errors such as

terminating with uncaught exception of type sc_core::sc_report: Error: (E118) find event failed: port is not bound: port 'player_instance_name.ClockIn' (sc_in)
In file: ../../../src/sysc/communication/sc_event_finder.cpp:51


Obviously the port selected for failure is which ever port is listed first (in this example a clock).

Second observation

  • adding a sc_main to User code eliminates the error but import order still matters
    • import must have User code first and Utils code second


All of this implies that each library must have its own sc_main and that only the last imported file will have all of its behavior honored (ie. binding registrations).

I have not tried wiring/binding in Utils and wiring/binding in User to see if there are further issues.

Likely I'm being naive in my implementation but is there a way around this behavior since it will be brittle to my end users?

It seems there must be some internal assumptions about sc_main and port registration/wiring.






Link to comment
Share on other sites

Well, actually a scenaron having a sc_main linking various shared objects which in turn reference the SystemC library as shared object works. So I suspect you build process is somehow wrong. To help you here you would need to post the your build log or at least the linker calls for your user and util liba and for your executable.

Best regards

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...