Archived

This forum has been archived. Please start a new discussion on GitHub.

About slice module

How can I use the structures (struct) or interfaces defined in other modules?

I want to create my module in which the interfaces or the structures referring to other interfaces or the structures defined in other modules, possibly in other .ice files.

I am using slice2java Eclipse plugin.

In my newly created .ice file, I cannot include my other .ice files which are located in the same directory.
In addition, I cannot reuse any modules I previously defined.

Please help.

Comments

  • xdm
    xdm La Coruña, Spain
    In my newly created .ice file, I cannot include my other .ice files which are located in the same directory.

    You need to use the -I option of the slice compiler, see "Configuring Project Settings" in http://www.zeroc.com/eclipse.html for how to do that with eclipse.
    In addition, I cannot reuse any modules I previously defined.

    Not sure what you mean. You can use the same module in several slice files, just reopen it.
    File: A.ice
    module Foo
    {
      struct Bar{int y, int x};
    };
    
    File: B.ice
    
    module Foo
    {
      interface test
      {
         void doSomeThingCool(Bar arg1);
      };
    };
    

    Hope this help,
    Jose
  • Instead of adding struct or interfaces into existing module

    Instead of adding struct or interfaces into existing module by reopening it,

    I want to create new module.

    Inside the newly created module, I wanted to create new interface inherited from the other interface defined in other module.

    The only thing I can do is reopening the module and adding into it ?
  • dwayne
    dwayne St. John's, Newfoundland
    You can use types from other modules by scoping them properly, For example
    module AModule
    {
    interface AIface
    {
        void AMethod();
    };
    };
    
    module BModule
    {
    interface BIface extends AModule::AIface
    {
        void BMethods();
    };
    };
    
  • Thanks

    Thanks. That's what I wanted!