Opened 16 years ago

Last modified 14 years ago

#1088 closed defect (fixed)

Constructor for an external object without (input) argument

Reported by: krsta Owned by: krsta
Priority: high Milestone:
Component: Version:
Keywords: Cc: krsta,

Description

Dear Developers,

I wanted to report my finding that OpenModelica does not seem to be capable of handling a constructor for an external object that does not have an (input) argument.

Not sure if this is a bug or not.

Regards,

Beat Arnet

package ExtObj
  class CGlobals
      extends ExternalObject;
    function constructor
      output CGlobals cg;

      external "C" cg=initCGlobals() ;
      annotation(Include="#include
\"../src/include.h\"",Library="ExtLib.lib");
    end constructor;
 
    function destructor
          input CGlobals cg;

      external "C" closeCGlobals(cg) ;
      annotation(Include="#include
\"../src/include.h\"",Library="ExtLib.lib");
    end destructor;
  end CGlobals;
 
  model ExtObjtest
    CGlobals cg=CGlobals();
    Real y;
  equation
    y=testCGlobals(cg);
  end ExtObjtest;
 
  function testCGlobals
    input CGlobals cg;
    output Real y;

    external "C" y=testCGlobals(cg) ;
  end testCGlobals;
end ExtObj;


model testextobj
  ExtObj.ExtObjtest t;
end testextobj;


record
    resultFile = "Simulation failed.
No matching function found for CGlobals() of type function() => ExtObj.CGlobals ExternalObject, candidates are function() => ExtObj.CGlobals ExternalObject Error occured while flattening model testextobj "
end record

Change History (2)

comment:1 by Adrian Pop, 16 years ago

Hi,

I was working on a fix for this some
while ago but I didn't push it in.

I think the problem is with the
calculation of constant-ness of
the input parameters. Because the
list of parameters is empty the
function that calculates the
constant-ness fails (it shouldn't).

A fix should be rather quick.

Cheers,
Adrian Pop/

comment:2 by Martin Sjölund, 14 years ago

Was fixed when I checked the trunk.

Note: See TracTickets for help on using tickets.