Hi, Building Firebird v2.5.3 from source, using msvc9 / Win32, trying to build a custom function into SysFunction.
I've cut the problem down to the thing that's giving me trouble: I want to return a non-null value when when the input expression resolves to null. In the code below I'm just trying to return a 0 (for the sake of the example). This executes but still gives me a null result: dsc* evlTestIt(Jrd::thread_db* tdbb, const SysFunction*, Jrd::jrd_nod* args, Jrd::impure_value* impure) { fb_assert(args->nod_count == 1); jrd_req* request = tdbb->getRequest(); dsc* value = EVL_expr(tdbb, args->nod_arg[0]); if (request->req_flags & req_null) { impure->vlu_desc.makeLong(0); impure->vlu_desc.setNullable(false); // redundant?? return &impure->vlu_desc; } return value; } This causes an access violation: dsc* evlTestIt(Jrd::thread_db* tdbb, const SysFunction*, Jrd::jrd_nod* args, Jrd::impure_value* impure) { fb_assert(args->nod_count == 1); jrd_req* request = tdbb->getRequest(); dsc* value = EVL_expr(tdbb, args->nod_arg[0]); if (request->req_flags & req_null) { dsc result; result.makeLong(0); result.setNullable(false); // redundant?? EVL_make_value(tdbb, &result, impure); return &impure->vlu_desc; } return value; } Both versions prepare okay, so I'm assuming my setParamsFunc and makeFunc functions are okay. I've tried various things, but at the moment these are set to setParamsFromList and makeFromListResult. I can probably debug down to find out why that second one is giving me an access violation, but that probably won't tell me what the right way to do this is (I'm assuming that I'm doing something wrong rather than hitting a bug). Any hints would be greatly appreciated. -- Geoff Worboys Telesis Computing Pty Ltd ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel