ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Protect Lisp functions from ObjectARX

5 REPLIES 5
Reply
Message 1 of 6
nishant.bhayani
506 Views, 5 Replies

Protect Lisp functions from ObjectARX

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

5 REPLIES 5
Message 2 of 6

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().

--
Owen Wengerd
ManuSoft
Message 3 of 6

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

Message 4 of 6

I tried acedEvaluateLisp as well, but didnt work.

 

resval = acedEvaluateLisp(_T("(pragma '((protect-assign func)))"),rb_out);

 

Thanks,

Nishant

Message 5 of 6

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,



Balaji
Developer Technical Services
Autodesk Developer Network

Message 6 of 6

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost