Mhh, this works for strings shorter than 4 characters, for longer strings there is a strange token behind:



Maybe the encoding is wrong? Which encoding does ghdl use? My console is set to UTF-8.


Tristan Gingold schrieb:
On Wed, Oct 21, 2009 at 02:14:00PM +0200, Markus Friedrich wrote:
  
Hi!

Is there any possibility to pass a string from ghdl to c? I tried it with:
    
[...]
  
Zeit: 4ns, ID: , value: 0�
    

Strings are not passed as char *, but using the ghdl internal representation.
Try with:

#include <stdio.h>

struct int_bounds
{
  int left;
  int right;
  char dir;
  unsigned int len;
};

struct ghdl_string
{
  char *base;
  struct int_bounds *bounds;
};

void writeToBlackboard(int time,
		       struct ghdl_string *id, struct ghdl_string *value)
{
  printf ("Id: %*s, val: %*s\n", id->bounds->len, id->base,
	  value->bounds->len, value->base);
}


--
Tristan. 

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss
  
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to