Thanks warm-hearted Edwin,
I've resolved it. But there is something I did not know during debug a c
function with the way you told me, some local variables can be watched well,
but the others can't be watched.
/*
** Creates an Environment and returns it.
*/
static value create_environment(value pool)
{
SQLHENV henv; /* environment handler */
SQLRETURN ret; /* return code */
value v;
/* uses connection pool or not */
val_check(pool,bool);
if(val_bool(pool))
{
SQLSetEnvAttr(SQL_NULL_HENV,
SQL_ATTR_CONNECTION_POOLING,(SQLPOINTER) SQL_CP_ONE_PER_HENV, SQL_NTS);
}
ret = SQLAllocHandle(hENV, SQL_NULL_HANDLE, &henv);
if (error(ret))
failure(NEKOSQL_PREFIX"error creating environment.");
ret = SQLSetEnvAttr (henv, SQL_ATTR_ODBC_VERSION, (void*)SQL_OV_ODBC3,
0);
if (error(ret))
{
failure (NEKOSQL_PREFIX"error setting SQL version.");
SQLFreeHandle (hENV, henv);
}
v = alloc_abstract(k_environment, henv);
val_gc(v, free_environment);
return v;
}
the local variable henv can be watched in the Locals window, but ret, v can't
be watched.
Is it effected by the neko vm or caused by my wrong operation?
flashvan
2006-09-26
>> Edwin van Rijkom
>> 2006-09-26 14:53:45
>> Neko intermediate language mailing list
>> Re: [Neko] value check exception when call a c function from haxe
>> Hi Jeremy,
>> On working with strings, you need to use the internal string
>> representation, like so:
>> public static function connect(host:String, uid:String, pwd:String)
>> {
>> var r = test(untyped host.__s, untyped uid.__s, untyped
>> pwd.__s);
>> }
>> For debugging, choose your projects 'debug' configuration, set
>> 'project setttings','debugging','command' to 'neko' (or its >> full
>> path) and enter the path to your compiled .n test file in
>> 'command arguments'.
>> Cheers,
>> Edwin
> flashvan wrote:
> Hello list,
> I am try to write my odbc module for neko vm these days.
> when testing a simple c function, I have got a exception.
> this is just a test,
>
> /*
> ** odbc.c output a module file named sql.ndll
> */
> static value test(value src, value uid, value pwd)
> {
> val_check(src, string);
> val_check(uid, string);
> val_check(pwd, string);
>
> return alloc_int(1);
> }
> DEFINE_PRIM(test, 3);
>
>
> // Odbc.hx, for test
> class Odbc
> {
> private static var test = neko.Lib.load("sql","test",3);
>
> public static function connect(host:String, uid:String, pwd:String)
> {
> var r = test(host, uid, pwd);
> }
>
> public static function main()
> {
> Odbc.connect("jeremy", "sa", "sa");
> }
> }
>
> after compiled, use command line
> F:\haxe-1.07 >neko Odbc.n
> Called from <null > line 1
> Called from Odbc.hx line 16
> Called from Odbc.hx line 10
> Uncaught exception - [EMAIL PROTECTED]
>
> what's going wrong ? who can explain it?
>
> I also found that it is very difficult to debug the module.
> How can I use step-by-step debugging in neko module developping?
> I use visual studio.net 2003.
>
> thanks,
>
>
>
>
> jeremy
> 2006-09-26
>
>
--
Neko : One VM to run them all
(http://nekovm.org)
--
Neko : One VM to run them all
(http://nekovm.org)