Re: C and other programming languages



"cr88192" <cr88192@xxxxxxxxxxxxxxxxxx> writes:

IMO, the FFI is one of those problems where it is nearly impossible to come
to a good solution. usually wrapping a C function requires manual effort,
because even if a few trivial things map, other things don't.
Well yes I agree, therfor my question. How is it done in you language
of choice. How easy do you find it, what do you like about the
approach taken and why?


most of the time it comes down to this:
write wrappers;
register wrappers;
try to wrap complex data in a way that doesn't totally suck.
Well you can write wrappers by hand, or you can generatrors like e.g
SWIG. However it's often automated or at least one gets tool support
either by the implementation itself or some third party tool. I have
used a few of them I have interfaced different parts with C, but my
knowledge can just be "regional". I for my part found the way this is
and can be done in Tcl/TK and/or Ruby not very difficult, I'd argue
the interface froim Tcl/Tk to C is somehow better, but I can not tell
exaclty why. And so I'd like to get other opions. Maybe the questions
is in the end how easy can interfacing different languages mean. Well
you can argue one should code for .NET which is supposed to be
"language" neutral. But well the current state of OSes is not that
they are build on anything close to .NET, but mostly some "C" dialekt.

I know on the other hand that especially the Lisp vendors have spend a
lot of money for making it easy to interface to libraries written in
C. In LispWorks e.g you feed some tools the headers and the code is
mostly generated automatically. Well they have experiences with this
since the infanthood of C. The Smalltalks fight "similiar" problems
and currently most of the scripting languages are written in C. But
IMHO interfacing is still quite "difficult"





IME, typically the later issue is at least a little easier. if anything,
nothing is really convinient from C, and at least macros are a good easy way
to wrap most problems in C (and in C++ there are a few even more powerful
mechanisms for wrapping...).
Oh, well I have to disagree, I'm not very fond of the Macros in C. But
that's a different story ;-(


the net result is that it is often not too difficult to use script features
(datatypes, ...) in C, but it is a horrible pain to use C code/data/... from
the script language.
I can not see that. It's quite easy at least in Ruby. They have
special suport for wrapping "C Datastructures.", and well I know from
at least one Eiffel where C is mostly the underslying implementation
of the basic data structures.

the general result is that:
the C codebase is either small or very centralized around the VM;
the scripted parts of the app are dominate;
often the app has poor access to external libraries;
...
Well yes that and so what are good example which are "bad"



if one can get the C and script code to share the same underlying mechanics,
then the problem should be a little easier.
Well this is quite general. What about a few example which are
especially dislike or like?


I don't as of yet have a working C compiler though, and there is still a
long way to go.


but then in all this I accomplish nothing new.
Oh, well if that would be "easier" one would have accomplish something
quite new ;-)

However thanks for you comments. I hope others will take them
further....


--
Please remove just-for-news- to reply via e-mail.
.



Relevant Pages

  • Re: running shell on a web server
    ... Languages where everything is a string and which revolve around ... syntax when executing commands using a system-like interface, ... HTML returned by the script). ... Use a real language. ...
    (sci.electronics.design)
  • Re: Apache/cgi question
    ... to execute a small test script wittern in a language other than perl? ... We have the Quovadx Cloverleaf product on our AIX Interface ... It uses TCL for its scripting language of choice. ...
    (comp.unix.aix)
  • Re: Excel OLE Automation: How to access constants ?
    ... define the constants in your script. ... Is there any way to access those constants through the COM interface? ... I am using this interface in PHP and JScript so far, ... answer to my question should be applicable to any language using the COM ...
    (microsoft.public.excel.programming)
  • Re: object system...
    ... conflict with the actual sun and stars (so, ... Interface too can have some properties defined in terms of third types ... not the language or its target. ... If you ignore overflow exceptions, then necessary, the semantics becomes ...
    (comp.object)
  • Re: Great SWT Program
    ... not sure what the user interface of 2057 will be like, ... GUIs initially seemed to me. ... The clipboard will probably see big changes; ... difficult to program than in some other language. ...
    (comp.lang.java.programmer)