ObjectARX

ObjectARX

Reply
Active Member
massoudshakeri
Posts: 8
Registered: ‎08-07-2009
Message 1 of 6 (448 Views)
Accepted Solution

How to load a Managed dll from an arx file?

448 Views, 5 Replies
05-03-2012 11:33 PM

Greetings,

Recently I had to add some features available only in .NET, to the project I developed using ObjectArx. I created a Managed dll using C#, and I want to load that dll when my main arx dll is loaded. I do not want to demand-load that dll by adding some registry keys.

As I found the command of "acrxDynamicLinker->loadModule()" does not work for managed dlls. I am wondering if there is another command or method to load a managed dll from inside an arx file.

With thanks in advance.

Massoud

 


massoudshakeri wrote:

The second method did not work either.




Try again. I've attached solution which was tested with AutoCAD 2012. It export command MyNetLoad which is analog of NETLOAD command and lisp function (netload <path_to_managed_dll>)

 

Moderator
Alexander.Rivilis
Posts: 1,449
Registered: ‎04-09-2008
Message 2 of 6 (444 Views)

Re: How to load a Managed dll from an arx file?

05-04-2012 12:44 AM in reply to: massoudshakeri

1) LoadLibrary()
2) Also acdbmgd.lib export function LoadManagedDll:
enum Acad::ErrorStatus __stdcall LoadManagedDll(ACHAR const *path);
Sample:

enum Acad::ErrorStatus __stdcall LoadManagedDll(ACHAR const *path);
static int ads_netload(void)
{
  struct resbuf *pArgs = acedGetArgs () ;
  acedRetNil();
  if (pArgs && pArgs->restype == RTSTR) {
  Acad::ErrorStatus es = LoadManagedDll(pArgs->resval.rstring);
  if (es != Acad::eOk) {
     acutPrintf(_T("\nLoadManagedDll(\"%s\")=%s"),
        pArgs->resval.rstring,acadErrorStatusText(es));
  } else 
    acedRetStr(pArgs->resval.rstring);
  } 
  return (RSRSLT) ;
}

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Member
massoudshakeri
Posts: 8
Registered: ‎08-07-2009
Message 3 of 6 (415 Views)

Re: How to load a Managed dll from an arx file?

05-05-2012 11:21 AM in reply to: massoudshakeri

Thanks for the response. But none of these methods work.

I need somehow make AutoCAD to load that managed DLL, in the same way acrxDynamicLinker->loadModule works. I do not think LoadLibrary() can do this.

The second method did not work either.



Moderator
Alexander.Rivilis
Posts: 1,449
Registered: ‎04-09-2008
Message 4 of 6 (406 Views)

Re: How to load a Managed dll from an arx file?

05-05-2012 12:40 PM in reply to: massoudshakeri

massoudshakeri wrote:

The second method did not work either.




Try again. I've attached solution which was tested with AutoCAD 2012. It export command MyNetLoad which is analog of NETLOAD command and lisp function (netload <path_to_managed_dll>)

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Active Member
massoudshakeri
Posts: 8
Registered: ‎08-07-2009
Message 5 of 6 (376 Views)

Re: How to load a Managed dll from an arx file?

05-07-2012 10:31 AM in reply to: massoudshakeri

Hi Alexander,

Thank you very much.

It worked for me.

 

Best Regards

Massoud





Moderator
Alexander.Rivilis
Posts: 1,449
Registered: ‎04-09-2008
Message 6 of 6 (374 Views)

Re: How to load a Managed dll from an arx file?

05-07-2012 10:36 AM in reply to: massoudshakeri

It worked for me.

What about Accept Solution?


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!