Previous 199869 Revisions Next

r26474 Sunday 1st December, 2013 at 23:58:57 UTC by Couriersud
Netlist: Fixed windows build.

Windows std dev tools use GCC 4.6.3. This version seems to be to broken to deal with "new" in static initialization. GCC 4.6.4 compiles this on linux without causing any issues. Anyhow, working now.

Note: Please delete all netlist related object files prior to compiling:

rm -rf  obj/windowsd/mame/drivers/pong.o obj/windowsd/emu/machine/net* obj/windowsd/emu/netlist/
[src/emu/netlist]pstring.c pstring.h

trunk/src/emu/netlist/pstring.c
r26473r26474
77#include <cstdio>
88
99
10pblockpool *pstring::m_pool = new pblockpool;
11pstring::str_t *pstring::m_zero = new(*pstring::m_pool, 0) pstring::str_t(0);
10//pblockpool *pstring::m_pool = new pblockpool;
11//pstring::str_t *pstring::m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
1212
13pblockpool pstring::m_pool;
14
15pstring::str_t *pstring::m_zero = NULL;
16
1317#define IMMEDIATE_MODE  (1)
1418#define DEBUG_MODE      (0)
1519
r26473r26474
9094{
9195    s->m_ref_count--;
9296    if (s->m_ref_count == 0)
93        m_pool->dealloc(s);
97        m_pool.dealloc(s);
9498}
9599
96100pstring::str_t *pstring::salloc(int n)
97101{
98    str_t *ret = new(*m_pool, n) str_t(n);
102    str_t *ret = new(m_pool, n) str_t(n);
99103    return ret;
100104}
101105
r26473r26474
115119    if (m_zero != NULL)
116120        sfree(m_zero);
117121    m_zero = NULL;
118    m_pool->m_shutdown = true;
119    m_pool->resetmem();
122    m_pool.m_shutdown = true;
123    m_pool.resetmem();
120124}
121125
122126// ----------------------------------------------------------------------------------------
trunk/src/emu/netlist/pstring.h
r26473r26474
4545    int m_align;
4646};
4747
48/* objects must be destroyed using destroy above */
49
50inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) throw (std::bad_alloc)
51{
52    void *result = pool.alloc(size + extra);
53    if (result == NULL)
54        throw std::bad_alloc();
55    return result;
56}
57
4858// ----------------------------------------------------------------------------------------
4959// nstring: immutable strings ...
5060//
r26473r26474
148158
149159    str_t *m_ptr;
150160
151    static pblockpool *m_pool;
161    static pblockpool m_pool;
152162
153163private:
154164    inline void init()
155165    {
166        if (m_zero == NULL)
167            m_zero = new(pstring::m_pool, 0) pstring::str_t(0);
156168        m_ptr = m_zero;
157169        m_ptr->m_ref_count++;
158170    }
r26473r26474
194206    static str_t *m_zero;
195207};
196208
197/* objects must be destroyed using destroy above */
198209
199inline void *operator new(std::size_t size, pblockpool &pool, int extra = 0) throw (std::bad_alloc)
200{
201    void *result = pool.alloc(size + extra);
202    if (result == NULL)
203        throw std::bad_alloc();
204    return result;
205}
206210
207
208211#endif /* _PSTRING_H_ */
209212

Previous 199869 Revisions Next


© 1997-2024 The MAME Team