Many external declarations in the OCaml standard library have a % at the beginning of the function name, such as the definition of int_of_float:
external int_of_float : float -> int = "%intoffloat"
What does the '%' mean?
...
I'm developing a small haskell program that uses an external static library I've developed in C++. It accesses the lib through ghc's FFI (foreign function interface). Inside this library I would like to do some output to the console. However, it looks to me like the c++ side of things does not have a correct handle to stdout because outp...
I have tried: scheme48, chicken, gambit, clojure.
I am looking for a scheme implementation that's readable (the implementation itself), and has a decent C++ ffi, and good debugging suport (so when I get an exception, I should get popped into a recursive repl).
What suggestions do people have?
...
I have interfaced Erlang mainly through port drivers but now with the advent of the erl_nif functionality, I am wondering if I should invest in Port Drivers anymore.
Will the erl_nif functionality boom or bust like FFI?
...
I am using the really awesome ruby ffi library to access functions in a c library in ruby.
Is there a way to iterate over the layout of a Ruby FFI::Struct?
example FFI::Struct:
class Example < FFI::Struct
layout :name, string,
:desc, :string,
:type, :int,
:value, :string
end
this doesn't seem to work but...
I am using GHC 6.12.1, in Ubuntu 10.04
When I try to use the FFI syntax for static storage, only modules running in interpreted mode (ie GHCI) work properly. Compiled modules have invalid pointers, and do not work. I'd like to know whether anybody can reproduce the problem, whether this an error in my code or GHC, and (if the latter) wh...
I'm trying to work out how to use ocamlfind to compile a C library and an OCaml executable using that C library.
I put together a set of rather silly example files.
% cat sillystubs.c
#include <stdio.h>
#include <caml/mlvalues.h>
#include <caml/memory.h>
#include <caml/alloc.h>
#include <caml/custom.h>
value
caml_silly_silly( value u...
On a ubuntu server, with everything installed (checked against another pc where this works just fine) When trying to run warble on one of my jruby projects, I get this error:
Function 'xmlFirstElementChild' not found in [libexslt.so]
/opt/jruby-1.5.0/lib/ruby/site_ruby/shared/ffi/ffi.rb:112:in `create_invoker'
/opt/jruby-1.5.0/lib/ruby/...
I have defined the following module to help me with FFI function export:
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, TypeSynonymInstances #-}
module ExportFFI where
import Foreign
import Foreign.C
class FFI basic ffitype | basic -> ffitype where
toFFI :: basic -> IO ffitype
fromFFI :: ffitype -> IO basic
f...
The title says it all, what are the trade offs between ffi and mri c extensions in ruby?
...
I am having difficulty setting up a struct from the pcap library in FFI.
Struct:
struct pcap_if {
struct pcap_if *next;
char *name;
char *description;
struct pcap_addr *addresses;
bpf_u_int32 flags;
};
The relevant Ruby code
module Pcap
extend FFI::Library
ffi_lib 'pcap'
attach_function :pcap_findalldevs,[:pointer,:...