C++ routines called from C must be defined as extern "C"

A C++ routine that is called from C code must be defined as extern "C".
Also clean up a couple other minor issues.
This commit is contained in:
Cary R 2011-07-04 13:19:37 -07:00 committed by Stephen Williams
parent 045a1b9808
commit f9a611c0cd
3 changed files with 19 additions and 19 deletions

View File

@ -1,7 +1,7 @@
#ifndef __architec_H
#define __architec_H
/*
* Copyright (c) 2011Stephen Williams (steve@icarus.com)
* Copyright (c) 2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -139,7 +139,7 @@ class ProcessStatement : public Architecture::Statement {
private:
int rewrite_as_always_edge_(Entity*ent, Architecture*arc);
int extract_anyedge_(Entity*ent, Architecture*arc);;
int extract_anyedge_(Entity*ent, Architecture*arc);
private:
perm_string iname_;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2010-2011 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -99,7 +99,7 @@ static pthread_cond_t work_queue_notempty_sig = PTHREAD_COND_INITIALIZER;
static pthread_cond_t work_queue_minfree_sig = PTHREAD_COND_INITIALIZER;
struct vcd_work_item_s* vcd_work_thread_peek(void)
extern "C" struct vcd_work_item_s* vcd_work_thread_peek(void)
{
// There must always only be 1 vcd work thread, and only the
// work thread decreases the fill, so if the work_queue_fill
@ -116,7 +116,7 @@ struct vcd_work_item_s* vcd_work_thread_peek(void)
return work_queue + work_queue_next;
}
void vcd_work_thread_pop(void)
extern "C" void vcd_work_thread_pop(void)
{
pthread_mutex_lock(&work_queue_mutex);
@ -217,7 +217,7 @@ static inline void unlock_item(bool flush_batch =false)
end_batch();
}
void vcd_work_sync(void)
extern "C" void vcd_work_sync(void)
{
if (current_batch_alloc > 0)
end_batch();
@ -230,33 +230,33 @@ void vcd_work_sync(void)
}
}
void vcd_work_flush(void)
extern "C" extern "C" void vcd_work_flush(void)
{
struct vcd_work_item_s*cell = grab_item();
cell->type = WT_FLUSH;
unlock_item(true);
}
void vcd_work_dumpon(void)
extern "C" void vcd_work_dumpon(void)
{
struct vcd_work_item_s*cell = grab_item();
cell->type = WT_DUMPON;
unlock_item();
}
void vcd_work_dumpoff(void)
extern "C" void vcd_work_dumpoff(void)
{
struct vcd_work_item_s*cell = grab_item();
cell->type = WT_DUMPOFF;
unlock_item();
}
void vcd_work_set_time(uint64_t val)
extern "C" void vcd_work_set_time(uint64_t val)
{
work_queue_next_time = val;
}
void vcd_work_emit_double(struct lxt2_wr_symbol*sym, double val)
extern "C" void vcd_work_emit_double(struct lxt2_wr_symbol*sym, double val)
{
struct vcd_work_item_s*cell = grab_item();
cell->type = WT_EMIT_DOUBLE;
@ -265,7 +265,7 @@ void vcd_work_emit_double(struct lxt2_wr_symbol*sym, double val)
unlock_item();
}
void vcd_work_emit_bits(struct lxt2_wr_symbol*sym, const char* val)
extern "C" void vcd_work_emit_bits(struct lxt2_wr_symbol*sym, const char* val)
{
struct vcd_work_item_s*cell = grab_item();
@ -276,7 +276,7 @@ void vcd_work_emit_bits(struct lxt2_wr_symbol*sym, const char* val)
unlock_item();
}
void vcd_work_terminate(void)
extern "C" void vcd_work_terminate(void)
{
struct vcd_work_item_s*cell = grab_item();
cell->type = WT_TERMINATE;

View File

@ -32,7 +32,7 @@ struct monitor_data {
struct t_vpi_time last_event;
};
static PLI_INT32 monitor_events(struct t_cb_data*cb)
extern "C" PLI_INT32 monitor_events(struct t_cb_data*cb)
{
struct monitor_data*mon = reinterpret_cast<monitor_data*> (cb->user_data);
@ -43,7 +43,7 @@ static PLI_INT32 monitor_events(struct t_cb_data*cb)
return 0;
}
static PLI_INT32 ivlh_attribute_event_compiletf(ICARUS_VPI_CONST PLI_BYTE8*)
extern "C" PLI_INT32 ivlh_attribute_event_compiletf(ICARUS_VPI_CONST PLI_BYTE8*)
{
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
vpiHandle argv = vpi_iterate(vpiArgument, sys);
@ -85,7 +85,7 @@ static PLI_INT32 ivlh_attribute_event_compiletf(ICARUS_VPI_CONST PLI_BYTE8*)
return 0;
}
static PLI_INT32 ivlh_attribute_event_calltf(ICARUS_VPI_CONST PLI_BYTE8*)
extern "C" PLI_INT32 ivlh_attribute_event_calltf(ICARUS_VPI_CONST PLI_BYTE8*)
{
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
@ -114,7 +114,7 @@ static PLI_INT32 ivlh_attribute_event_calltf(ICARUS_VPI_CONST PLI_BYTE8*)
return 0;
}
static void vhdl_register(void)
extern "C" void vhdl_register(void)
{
s_vpi_systf_data tf_data;
@ -123,11 +123,11 @@ static void vhdl_register(void)
tf_data.calltf = ivlh_attribute_event_calltf;
tf_data.compiletf = ivlh_attribute_event_compiletf;
tf_data.sizetf = 0;
tf_data.user_data = "$ivlh_attribute_event";
tf_data.user_data = (PLI_BYTE8 *) "$ivlh_attribute_event";
vpi_register_systf(&tf_data);
}
void (*vlog_startup_routines[])() = {
extern "C" void (*vlog_startup_routines[])() = {
vhdl_register,
0
};