Thanks to barche and others I was able to start making good progress using CxxWrap.jl.
I do still have one blocking question: how can I wrap a class which has public member variables whose values are supposed to be changed from outside during runtime? And what if these member variables are actually pointers to objects of other classes?
To illustrate my question I pasted simple code from a VC++ console application below. Question is, how can I expose “complex” and “complexcalc” using CxxWrap to Julia in a DLL project.
BTW I know the classes are organized a bit awkwardly… This is just a simplified example. In reality I am using a third party VC++ DLL that I have no access to source code except the header file necessary to use the exposed classes.
Thanks!!
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
class complex
{
public:
double r, i;
double sq_mod(void) {
return r*r + i*i;
}
};
class complexcalc
{
public:
complex *a;
complex *b;
double sum_sq_mod(void) {
return a->sq_mod() + b->sq_mod();
};
};
int main()
{
complex a, b;
a.r = 0.5;
a.i = 0.6;
b.r = 2.5;
b.i = 3.6;
complexcalc mycalc;
mycalc.a = &a;
mycalc.b = &b;
double result = mycalc.sum_sq_mod();
printf("The result is: %f\n\n", result);
printf("Press Enter to exit.");
getchar();
return 0;
}