Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Compiling DLLs cross-referencing each other 09 Jan 2022 12:36 #21044

  • alex_schmitt


  • Posts: 10
  • Hey all,

    I am conducting my first attempts in migrating our project from VO and XS.

    One thing I stumbled across was the following:

    Assuming you have project A that uses a CLASS from project B and project B a CLASS from project A.
    In VO it was possible to mutually reference between the two in the respective "Application Options" in the libraries tab.
    • If you would compile say project A it would compile everything except the part where project B is referenced (as this is not yet compiled).
    • So going back to project B and compiling project B it would compile everything except the part where project A is referenced.
    • So compiling project A would now succeed.
    • And finally, project B can be compiled.

    Compiling project A in XS the compiler is looking for the DLL from project B, which is of course not there - and vice versa.

    What would be the best practice to resolve this?

    Best,
    Alex

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 09 Jan 2022 13:05 #21045

    • SHirsch
    • SHirsch's Avatar


  • Posts: 239
  • Hello Alex,

    you may extract all classes that are used in both projects to a new base library. Then you can compile your base lib and then set a reference in project A and project B to your new base lib.

    Regards
    Stefan

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 09 Jan 2022 14:21 #21046

    • alex_schmitt


  • Posts: 10
  • Hey Stefan,

    Thanks! I was fearing this step ;) But apparently now away around this. Apparently this is the cleanest way anyhow, even for VO.

    Best,
    Alex

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 09 Jan 2022 14:58 #21048

    • robert
    • robert's Avatar


  • Posts: 2593
  • Alex,
    You can also declare an interface for one of the classes and declare that interface in the other classlibrary.
    Assume Class A and Class B, ClassLibrary A has Class A and ClassLibrary B has class B
    You declare InterfaceB in classLibrary A and set a reference from ClassLibrary B to ClassLibrary A and add the "IMPLEMENTS InterfaceB" to the declaration of class B.
    Inside ClassLibrary A you then replace the name ClassB with InterfaceB and it should work.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 09 Jan 2022 15:03 #21049

    • alex_schmitt


  • Posts: 10
  • Thanks Robert!

    While digging deeper I found a lot of inter-project dependencies and the most straightforward way would likely be to place everything into one library. There's only 2-3 EXEs making use of it so that should still be valid.
    I'll give it a try. Everything else seems to depict major refactoring.

    Best,
    Alex

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 09 Jan 2022 15:17 #21050

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2878
  • Hi Alex,
    you can also do something different: define the objects "as object" and use CreateInstance() to create the objects. This was you can prepare your code on the VO side before migration.
    Is is not the cleanest method, but IMHO the most simple one, and the only one that let you have the same code on both the VO and the X# side.
    Wolfgang
    P.S. IMHO VO should never have admit these circular references. I have seen a project with many circular referenced applications that takes several hours (!) to compile in VO.
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 09 Jan 2022 20:34 #21057

    • alex_schmitt


  • Posts: 10
  • Thanks, Wolfgang.

    I could finally manage by merging all applications into one and it looks like I am on a good track with this.

    I agree the circular references are not best practice at all, but as it worked and was convenient, I just used this ;)

    Best,
    Alex

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 10 Jan 2022 06:08 #21064

    • wriedmann
    • wriedmann's Avatar


  • Posts: 2878
  • Hi Alex,
    merging into one application for sure is the easiest and safest option.
    But when you are done with the migration you should think about splitting it up again in a different manner to make compilation times shorter.
    Unlike VO (where only "dead" entities are compiled) the X# compiler (like the C# compiler) compiles the entire application every time.
    Wolfgang
    Wolfgang Riedmann
    Meran, South Tyrol, Italy

    www.riedmann.it - docs.xsharp.it

    Please Log in or Create an account to join the conversation.

    Compiling DLLs cross-referencing each other 16 Jan 2022 22:10 #21125

    • alex_schmitt


  • Posts: 10
  • That's definitively a good hint, Wolfgang. I already see the differences in compile times :)

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1