tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] how to set the 'include' path in embeded C script?


From: Fred Weigel
Subject: Re: [Tinycc-devel] how to set the 'include' path in embeded C script?
Date: Fri, 02 Mar 2007 18:01:24 -0500

This function requires the floating library to link. Indeed

#include "stdlib.h"
#include "stdio.h"
#include "math.h"

float fraction(void)
{
return sin(3.1415926/6); //that will err
}

int main(void)
{
    fraction();
    return 0;
}

errors if compiled with "tcc s.c", but is ok if you use "tcc s.c -lm".
Now, I haven't used tcc as an embedded compiler, and so don't know the
syntax needed to introduce libraries. Maybe you can dlopen() "libm.so"
before the compile -- it should find it (hopefully).

Fred Weigel

On Mon, 2007-02-26 at 17:12 -0500, Rob Landley wrote:
> Did you ever get an answer to this question?
> 
> Rob
> 
> On Wednesday 27 December 2006 8:29 am, oyster wrote:
> > Hi, everyone.
> > In fact, I use libtcc.so in http://www.cs.tut.fi/~ask/cinpy/, which is
> > a Python(www.python.org) library can implement functions with C in
> > Python script directly.
> > 
> > My question is, how to set the 'include' path, so that libtcc.so can
> > find it. Thanx
> > The following python exits with "ValueError: tcc_relocate returned
> > error code -1."
> > [code]
> > import ctypes
> > import cinpy
> > fraction=cinpy.defc("fraction",
> >                 ctypes.CFUNCTYPE(ctypes.c_float,None),
> >                 """
> >                 #include "stdlib.h"
> >                 #include "stdio.h"
> >                 #include "math.h"
> > 
> >                 float fraction(void)
> >                 {
> >                     return sin(3.1415926/6); //that will err
> >                     //return 1; //but this will be ok
> >             }
> >             """)
> >                             
> > print fraction()
> > [/code]
> > 
> > 
> > _______________________________________________
> > Tinycc-devel mailing list
> > address@hidden
> > http://lists.nongnu.org/mailman/listinfo/tinycc-devel
> > 
> > 
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]