[Ur] compiling javascript ffi example

Edward Z. Yang ezyang at MIT.EDU
Wed Apr 25 04:14:19 EDT 2012


Hello Tim,

The JavaScript FFI is a bit different from the C FFI, so modifying
the C example is not the best way to do it.  You should crack open
the manual, and look up jsFunc, clientOnly and ffi urp directives.

Edward

Excerpts from Timothy Beyer's message of Wed Apr 25 04:07:59 -0400 2012:
> Hi,
> 
> In trying to learn the javascript FFI for Ur/Web, I recently made an example based on the C FFI example from the wiki. (http://www.impredicative.com/wiki/index.php/Ur_C_FFI_Example)  Basically, it consists of "lib" and "app", with the three javascript functions "hello", "counter" and "important".
> 
> Unfortunately, I can't get it to compile, although I am confident that it is close to working.  I get the following errors from gcc when I compile "app":
> 
> > urweb app
> cc1: warnings being treated as errors
> /tmp/fileHhSFRZ/webapp.c: In function '__uwn_wrap_counter_1272':
> /tmp/fileHhSFRZ/webapp.c:49: warning: implicit declaration of function 'uw_Lib_counter'
> /tmp/fileHhSFRZ/webapp.c: In function '__uwn_wrap_main_1271':
> /tmp/fileHhSFRZ/webapp.c:82: warning: implicit declaration of function 'uw_Lib_hello'
> /tmp/fileHhSFRZ/webapp.c:83: warning: passing argument 2 of 'uw_Basis_htmlifyString_w' makes pointer from integer without a cast
> /tmp/fileHhSFRZ/webapp.c:88: warning: implicit declaration of function 'uw_Lib_important'
> /tmp/fileHhSFRZ/webapp.c:89: warning: passing argument 2 of 'uw_Basis_htmlifyString_w' makes pointer from integer without a cast
> *** Error code 1
> 
> The modified example from the wiki is attached as a bzipped tarball.
> 
> Regards,
> Tim



More information about the Ur mailing list