Hi,
I want to protect lisp functions from ObjectARX. I am able to protect the functions from LISP command prompt as below.
(pragma '((protect-assign MyFunction)))
I want to do it programmatically using ObjectARX. I have written below code but I am getting error "some other error".
struct resbuf *cmdlist;
resbuf *rb_out = NULL;
cmdlist = acutBuildList(RTSTR, _T("pragma"),RTSTR, _T("protect-assign"),RTSTR,_T("MyFunction"), 0);
int resval = acedInvoke(cmdlist,&rb_out);
if (RTNORM != resval)
{
acedAlert(_T("Error"));
}
acutRelRb(cmdlist);
Please help me and let me know if more information required.
Thanks,
Nishant
You'll need to either create a wrapper function in lisp and call the wrapper, or perhaps use the undocumented acedEvaluateLisp() function instead of acedInvoke().
I tried below as suggested, but its not protecting the functions.
AcApDocument *doc;
AcApDocManager *manager;
Acad::ErrorStatus err = acDocManager->sendStringToExecute(acDocManager->curDocument(), _T("(pragma '((protect-assign func))) "), false, true, false);
if(err == Acad::eOk)
acedAlert(_T("Ok"));
else if(err == Acad::eNoDocument)
acedAlert(_T("eNoDocument"));
else if (err == Acad::eBufferTooSmall)
acedAlert(_T("eBufferTooSmall"));
It returns Acad::eOk always, but not protecting the function.
Thanks,
Nishant
I tried acedEvaluateLisp as well, but didnt work.
resval = acedEvaluateLisp(_T("(pragma '((protect-assign func)))"),rb_out);
Thanks,
Nishant
Hi Nishant,
I may not be addressing your original query.
I am only wondering why you would want to use the (protect-assign) since it only protects the symbols when the VLisp IDE is open. Also the level of protection is configurable through the VLisp IDE options and can be overridden to not display the error message.
Regards,
Hi Balaji,
Thanks for your reply.
I am trying to build a library and have written wrappers over Lisp functions. Now I want to have function like "Protect_functions" in my library, which should protect the functions.
Thanks,
Nishant