Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: outputting C code

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116744] Re: outputting C code
  • From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
  • Date: Fri, 25 Feb 2011 06:38:41 -0500 (EST)

Hi,

On Thu, 24 Feb 2011, HonestMath wrote:

> Thank you for your reply, I studied the examples you presented.
>
> It looks like I am able to create some code for external use.
> However, I wonder if enough code is generated or if some is in byte
> code for that platform.  Let me elaborate.  I want to know if it is
> possible to create a function that calls built-in Mathematica
> functions, and use this in an external software package.
>

Yes and no; for example Sin[] is a build in function and you can compile 
that, however, NDSolve[] is also a build in function and you can not 
compile that one. If you can compile the functions in question then you 
can generate C code. To check if the compiled code needs a call back to 
the M- evaluator, I usually use CompilePrint and see if there is a call to 
MainEvaluate.

> For example,  if I have an application meant for use on an Android
> device, is it possible for Mathematica to give me all I need to
> generate a Java library, or C source code that can be compiled for a
> Java device?  As compilation is device dependent, it seems it might be
> limited to the device on which Mathematica is running.  If you have
> Mathematica for Windows, it generates Windows code, if on a Mac, it
> generates Mac code.  Is this correct, or is there a way to get all I
> need to run on an Android, Palm, or iphone?
>
> Cheers!
>

Oh, this is definitely out of my turf... Here are some notes on how to 
build for a different target system

CCompilerDriver/tutorial/Compilation#8215639
And the section on setting the compiler.

Oliver

>
>
>
> On Feb 23, 3:23 am, Oliver Ruebenkoenig <ruebe... at wolfram.com> wrote:
>> On Wed, 23 Feb 2011, HonestMath wrote:
>>> Hello all,
>>
>>> I know that Mathematica 8 contains the ability to export your
>>> functions to C code. I am wondering what the extent of that might be.
>>> If my function were to contain references to built in Mathematica
>>> functions, are those too output?
>>
>>> Is it possible to use built-in functions for use in an external
>>> library?
>>
>>> Cheers,
>>
>>> Matt
>>
>> Hallo Matt,
>>
>> you might want to consult the documentation for this
>>
>> see for example:
>> CCodeGenerator/tutorial/Examples#659427467
>> ref/LiftingFilterData#258228157
>>
>> those should get your started
>>
>> hth,
>> Oliver
>
>
>


  • Prev by Date: Re: FinancialData Function Not Working for Property "Members"
  • Next by Date: Re: Mathematica Weirdness
  • Previous by thread: Re: outputting C code
  • Next by thread: Re: outputting C code