logo       

SWIG C# and plain C: msg#00172

programming.swig

Subject: SWIG C# and plain C

I'm using cscc to compile up some plain C code, and want to use SWIG to wrap
my library (Also plain C code)
Is this possible ?

I've tried using swig -csharp, generated a .so but when I run the c code it
comes up with unresolved externals...



.i file :
%module libaubit4gl_cs
%{
struct sqlca_struct {
long sqlcode;
char sqlerrm[73];
char sqlerrp[9];
int sqlerrd[6];
char sqlawarn[9];
char sqlstate[10];
};


%}

struct sqlca_struct {
long sqlcode;
char sqlerrm[73];
char sqlerrp[9];
int sqlerrd[6];
char sqlawarn[9];
char sqlstate[10];
};

extern int A4GL_get_a4gl_sqlca_sqlcode (void);
extern int A4GL_get_a4gl_status (void);
extern long a4gl_status;
extern struct sqlca_struct a4gl_sqlca;
extern void A4GLSTK_pushFunction (const char *functionName, char *xparams[],
int n);
extern void A4GL_chk_err (int lineno, char *fname);
extern void A4GL_display_at (int n, int a);
extern void A4GL_fgl_end_4gl_0 (void);
extern void A4GL_push_char (char *p);
extern void A4GL_push_chars (char *p, int dtype, int size);
extern void A4GL_push_int (short p);
extern void A4GL_set_a4gl_sqlca_sqlcode (int a);
extern void A4GL_set_a4gl_status (int a);



Make script :

swig -csharp aubit4gl_cs.i
gcc -c -fpic libaubit4gl_wrap.c
gcc -shared libaubit4gl_wrap.o -o libaubit4gl_cs.so -L../lib
-laubit4gl

*libaubit4gl.so is the library I want to wrap


cscc m1.c -I/Path/to/my/libs/incl [all swig cs modules] -o m1.exe


/opt/portable.net/mjatest > ilrun ./m1.exe
token 0x0A000004: member `<Module>.A4GLSTK_setCurrentLine' not found
token 0x0A000005: member `<Module>.A4GL_fgl_start' not found
token 0x0A000006: member `<Module>.A4GLSTK_initFunctionCallStack' not found
token 0x0A000007: member `<Module>.A4GLSTK_pushFunction' not found
token 0x0A000008: member `<Module>.aclfgli_clr_err_flg' not found
token 0x0A000009: member `<Module>.A4GL_push_char' not found
token 0x0A00000A: member `<Module>.A4GL_push_int' not found
token 0x0A00000B: member `<Module>.A4GL_display_at' not found
token 0x0A00000C: member `<Module>.aclfgli_get_err_flg' not found
token 0x0A00000D: member `<Module>.a4gl_sqlca' not found
token 0x0A00000E: member `struct (9_TVezMQxy7QiLvWbXzAgM).sqlcode' not found
token 0x0A00000F: member `<Module>.a4gl_status' not found
token 0x0A000010: member `<Module>.A4GL_chk_err' not found
token 0x0A000011: member `<Module>.A4GL_fgl_end_4gl_0' not found
./m1.exe: unresolved external references

(These are all defined in my library)

Any ideas ?
(I'm assuming that libaubit4gl_cs.so will be picked up from the current
directory)


_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise