[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon May 10 15:55:23 1999 
Subject:Re: Using other languages within POP11 
From:Stuart I Reynolds 
Volume-ID:990510.06 

Trent J Rosenbaum wrote:
> 
> I am interested in using other languages within POP11.
> 
> Can C, C++ or Java code be used within POP11?
> 

As Aaron pointed out C is possible. I made some attempts to integrate
some C++ code with POP11 a while ago. I don't think POP deals with the
way C++ classes are named inside the libraries. The standard way around
this is to write C wrappers of the C++:

MyClass* newMyClass(int arg1, int arg2)
{
  return new MyClass(arg1, arg2)
}

void delMyClass(MyClass* obj)
{
  delete obj;
}

void setA(MyClass* obj, int newval)
{
  obj->setA(newval);
}

int getA(MyClass* obj)
{
  return obj->getA();
}


You should be able to externalise the following C names in the standard
way. Also you will need to compile the C/C++ into shared object files.


If anyone has success in doing this please let me know. There is a tool
(called SWIG from http://www.swig.org) which could be extended to
automate this entire process, producing C/C++ interfaces to POP11 and
all the relevant wrappers from their sources.


Stuart

PS. Local (Comp Sci/Bham University) users will probably want to use the
EGCS version of g++. To do this just type: setup EGCS