V
Vincezo Ciaschini
Supposing you have the following declaration in a header file:
-- head.h --
struct s {
int c;
char v;
#if defined(__cplusplus)
s();
s(double);
method1(int);
method2(float);
#endif
};
and then two sources,
-- cppsrc.cc --
#include "head.h"
extern "C" {
s *create(void)
{
s *res = new s(1.0);
res->method1(4);
return res;
}
-- csrc.c --
#include "head.h"
extern struct s *create(void);
int f()
{
struct s* val = create();
val->v = 'd';
}
Is this legal/portable?
Thanks in advance,
Vincenzo
-- head.h --
struct s {
int c;
char v;
#if defined(__cplusplus)
s();
s(double);
method1(int);
method2(float);
#endif
};
and then two sources,
-- cppsrc.cc --
#include "head.h"
extern "C" {
s *create(void)
{
s *res = new s(1.0);
res->method1(4);
return res;
}
-- csrc.c --
#include "head.h"
extern struct s *create(void);
int f()
{
struct s* val = create();
val->v = 'd';
}
Is this legal/portable?
Thanks in advance,
Vincenzo