ObjectARX

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

How to load a Managed dll from an arx file?

428 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

 

Moderator
Alexander.Rivilis
Posts: 1,398
Registered: ‎04-09-2008
Message 2 of 6 (424 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 (395 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,398
Registered: ‎04-09-2008
Message 4 of 6 (386 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 (356 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,398
Registered: ‎04-09-2008
Message 6 of 6 (354 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community