gnucap-devel
[Top][All Lists]
Advanced

[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 2.0.0.22 (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
http://lists.gnu.org/archive/html/gnucap-devel/2007-04/msg00003.html
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
http://lists.gnu.org/archive/html/gnucap-devel/2007-11/msg00020.html

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 spice-wrapper.cc 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 spice-wrapper.cc 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.


Regards

Holger





So this is what I did:

spice-wrapper.cc:87 and others
FLOAT --> NFLOAT

spice-wrapper.cc:909-910
 LOGIC_NODE* nodestat = get_nstat();
 if (!nodestat) {


globals.h:25
#include "md.h"
globals.h:43-44
extern LOGIC_NODE* nstat;
extern INTERFACE LOGIC_NODE* get_nstat();

e_node.cc:31
INTERFACE LOGIC_NODE* get_nstat(); //hv

e_node.cc:588-591
INTERFACE LOGIC_NODE* get_nstat() //hv
{
   return nstat;
};

m_expression.h:114
class INTERFACE Expression

D:\gnucap\gnucap-2009-06-11\src\md.h:130
#undef INTERFACE

D:\gnucap\gnucap-2009-06-11\modelgen\md.h:130
#undef INTERFACE



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

PREFIX=/d/software/gnucap
GNUCAP_INCLUDE = ../../src
CC = gcc
CCC = g++
LDFLAGS = -shared -L$(GNUCAP_INCLUDE)
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
gcc -O2 -g -I. -I../Include -DTRACE_UNTESTED -DSPICE_3f -DPREDICTOR -DHAS_STDLIB
-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):

cpstd.h:35
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]