11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

296 • Chapter 7: <strong>Advanced</strong> ConnectivitySince num1 and num2 are both ints, they can be specified as the followingin Maple.num1::integer[4]num2::integer[4]The return type does not have a name so the keyword RETURN is used.RETURN::integer[4]Using all of this information, the complete function can be defined bycalling the Maple function define_external.> myAdd := define_external(> ’add’,> ’num1’::integer[4],> ’num2’::integer[4],> ’RETURN’::integer[4],> ’LIB’="mylib.dll"> );Important: Specify the function exactly, and ensure that the argumentsare in the correct order. Failure to do this may result in strange behavioror program crashes when executing Step 3.Step 3: Function Invocation Executing the define_external call formyAdd returns a Maple procedure that translates Maple types to hardwaretypes that can work with an external function. This procedure can be usedthe same way as other Maple procedures.> myAdd(1,2);3> a := 33:> b := 22:> myAdd(a,b);55> r:= myAdd(a,11);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!