[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnucap-devel] BSIM plugins with MINGW

From: Holger Vogt
Subject: [Gnucap-devel] BSIM plugins with MINGW
Date: Mon, 20 Jul 2009 21:06:13 +0200
User-agent: Thunderbird (Windows/20090605)

Hi all,

after some discussions in 2007 there was no further mention of plugins made with mingw. So I am not aware of any solution to the build problems. Using the actual 6/11/09 gnucap snapshot, gnucap compiled "out of the box" with mingw, but making the plugins failed immediately.

I have made the mingw BSIM plugins using a strange step by step approach, not production worthy, but giving hints to what needs to be done further. I am using gcc345 and msys1.0.

This is a continuation of the thread
[Gnucap-devel] Re: [Help-gnucap] plugins mingw compatibility
from Wed, 4 Apr 2007.

Making a dll requires that no unresolved symbols are there inside the dll code, otherwise linking will fail. This is a much more stringent requirement compared with making a *.so.

So my procedure is based on the ideas in

We need to export the symbols from gnucap.exe back to the dlls (via the symbol table libgnucap2.a).

Exporting the symbol of the global variable nstat from gnucap.exe however did not work, so I added a function INTERFACE LOGIC_NODE* get_nstat() which will be exported and used by to get the value of nstat. Still there was a dependency problem with nstat inside the gnucap code during linking the dlls, which I removed by "brute force" (not knowing if this has any adverse influence).

Perhaps it might be better to put all symbols (function addresses) required by into a struct of function pointers, and hand this struct over from gnucap.exe to the dll during attaching the dll.

If these problems have been already solved, please let me know.



So this is what I did: and others
 LOGIC_NODE* nodestat = get_nstat();
 if (!nodestat) {

#include "md.h"
extern LOGIC_NODE* nstat;
extern INTERFACE LOGIC_NODE* get_nstat();
INTERFACE LOGIC_NODE* get_nstat(); //hv
INTERFACE LOGIC_NODE* get_nstat() //hv
   return nstat;

class INTERFACE Expression



edit make2 in D:\gnucap\gnucap-2009-06-11\models-bsim\Make2 (based on make2.mingw):

GNUCAP_INCLUDE = ../../src
CC = gcc
CCC = g++
LIBS = -lgnucap2
$(CCC) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)$(SO_EXTENSION) 2>&1 | c++filt

prepare gnucap:
$ cd d:/gnucap/gnucap-2009-06-11
$ ./configure --prefix=/d/software/gnucap

make gnucap:
$ cd d:/gnucap/gnucap-2009-06-11
$ make

make dlls:
$ cd d:/gnucap/gnucap-2009-06-11/src
$ ar cru  libgnucap.a *.o
$ ar -s  libgnucap.a
$ dlltool -l libgnucap2.a -D gnucap.exe libgnucap.a
$ cd d:/gnucap/gnucap-2009-06-11/models-bsim
$ make clean
$ make

Resulting error message:
make[1]: Entering directory `/d/gnucap/gnucap-2009-06-11/models-bsim/BSIM3v31' g++ -shared -L../../src spice-wrapper.o b3acld.o b3cvtest.o b3del.o b3dest.o b3getic.o b3ld.o b3mask.o b3mdel.o b3mpar.o b3par.o b3pzld.o b3set.o b3temp.o b3trunc.o b3.o b3ask.o b3noi.o b3check.o devsup.o -lgnucap2 -o bsim310.dll 2>&1 | c++filt
spice-wrapper.o: In function `ZN9DEV_SPICE7ac_loadEv':
d:/gnucap/gnucap-2009-06-11/models-bsim/BSIM3v31/../../src/e_node.h:299: undefined reference to `nstat'
collect2: ld returned 1 exit status
echo bsim310 done
bsim310 done

avoid error message during making the dlls (brute force)
e_node.h: 297
extern LOGIC_NODE* nstat; --> LOGIC_NODE* nstat = NULL;
make gnucap
make dlls

BSIM420 to BSIM463: compilation of b4set.c fails with
-DMAKE_DLL -c b4set.c
In file included from ../Include/ftedata.h:12,
                from ../Include/fteparse.h:15,
                from ../Include/ftedefs.h:16,
                from b4set.c:27:
../Include/cpstd.h:35: error: redefinition of `struct _complex'
make[1]: *** [b4set.o] Error 1

_complex is nowhere used in gnucap (but complex is):

struct _complex --> struct _complex1

struct _complex1 { double cx_real;
   double cx_imag;
} ;

typedef struct _complex1 complex;

#define realpart(cval)  ((struct _complex1 *) (cval))->cx_real
#define imagpart(cval)  ((struct _complex1 *) (cval))->cx_imag

return to original code in e_node.h
make gnucap

copy gnucap.exe and b*.dll into /bin directory, load a plugin model and start simulation.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]