I'm having trouble using the J601i library routines on linux.

This segfaults in C at the (*JDo) function call:

#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

void main(void)
{
  void *handle;
  int (__attribute__((stdcall)) *JDo)(char *);
  char *error;
  int jreturn;

  char *s = ";:'J Is Fun!'";

  handle = dlopen("libj601.so", RTLD_LAZY);
  if(!handle) {
    fputs(dlerror(), stderr);
    exit(1);
  }

  JDo = dlsym(handle, "JDo");
  if ((error = dlerror()) != NULL) {
    fputs(error, stderr);
    exit(1);
  }

  jreturn = (*JDo)(s);
  printf("%d\n", jreturn);

  dlclose(handle);

}


This crashes J (with and without the '+'):

load'dll
cmd=: '''abc'' 1!:2 <''t1.txt'''
'libj601.so JDo + i *c' cd <cmd

I apologize if this has already been addressed.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to