slang-devel mailing list

[2018 Date Index] [2018 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-devel] Re: tcc module


Ag. D.E Chatzimanikas <aga.chatzimanikas@xxxxxxxxx> wrote:
> /lib/i386-linux-gnu and /usr/lib/i386-linux-gnu
>
> I guess we can use something like uname.(machine|sysname) to determinate
> (without resorting to specific system support (which is undesirable))
> the library path.

The library paths searched by the dynamic linker are specified in
/etc/ld.so.conf.  The best way may be to use the paths specified there.

[...]
>> >    __tcc__ ("C code here that interacts with interpreter variables");
>
> So you say to me that, in the C side of code, at some point the program,
> lets say: it had to realloc (var)
> but you still want to work reliably with that reference from slang?

Yes, if it affects an existing slang variable.

> (if you can give me an example and the possible ways that the interpreter
> will crash, that will be helpfull (not one of quick John Davis algorithms,
> that takes years to understand (something simple (for dumbs))))

Sure, here is one that will likely cause a crash:

    static void crash (void) { char *p = NULL;  *p = 0; }

Here is another:

    static int crash (int x) { return crash (x+1); }

And another:

    static void crash (int *x) { while(1) { *x++ = 0; } }

>> First, the tcc api gives the freedom to call a callback function when
>> encounters an error, with the following signature:
>> 
>>   void __tcc_error_handler (void *opaque, const char *msg)
>> 
>> For now, the default handler in the tcc-module looks first for a slang
>> defined function "tcc_error_handler".
>> If it is defined, it pushes the message string and calls that function.

Does that handler trap Segmentation Violations, etc?  Is there anyway
to run the tcc code in a protected environment so that it will not
affect the interpreter in undesirable ways?  The only way that I know
how to do this would be to run the tcc-compiled code in a separate
process and communicate back via shared memory or file descriptors.

Thanks,
--John
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.


[2018 date index] [2018 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]