.NET

Reply
Valued Contributor
FRPT1257
Posts: 69
Registered: ‎05-03-2006
Message 1 of 10 (266 Views)
Accepted Solution

AutoCAD 32bits and 64bits API

266 Views, 9 Replies
07-18-2014 03:18 PM

It will possible run the same application addin in both AutoCAD 32bits and 64bits?

 

For example, if the addin is developed in 32bits it will work in AutoCAD 64bits plataform?

Or it will be necessary create and compile 2 different addins?

 

For example in Inventor 2015 it will be possible compile the addin for both platforms and use the same addin in both Inventors (32bits and 64bits).

This is possible too for AutoCAD?

 

Thanks & Regards,

Rui

Inventor .NET API uses COM/Interop (Autodesk.Inventor.Interop.dll) which is Any CPU. Any .NET plugin which is built as Any CPU and references Any CPU .NET assemblies should work for all platforms (x86 and x64).


AutoCAD .NET API uses targeted platform (x86 or x64) for accoremgd.dll, acdbmgd.dll and acmgd.dll, as they heavily use unmanaged objects from native AutoCAD DLLs (x86 or x64). Your .NET plugin is Any CPU and it can reference both x86 and x64 .NET assemblies. Therefore, it may work on both platforms (AutoCAD 32 bits and 64 bits).


The restriction happens when your .NET plugin references a non-.NET assembly such as ActiveX/COM which was compiled from C++, and targeted by either x86 or x64. If your plugin references x64 ActiveX control, it cannot work on x86 machine, and vice versa.


We cannot reference an ActiveX control created by .NET to .NET plugins. Therefore, third-party ActiveX/COM libraries use in .NET plugins are compiled from non-.NET languages such as C++, VB… Those libraries are really care about 32 bits or 64 bits.


I don’t have AutoCAD 32 bit to test my Any CPU .NET plugins yet, as it requires Windows 32 bit. I am not sure all Any CPU plugins can work on AutoCAD 32 bit. As this topic is interesting so I want to point some ideas for further discussion.


Khoa

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

Re: AutoCAD 32bits and 64bits API

07-18-2014 03:52 PM in reply to: FRPT1257

FRPT1257 wrote:

It will possible run the same application addin in both AutoCAD 32bits and 64bits?


Yes. But there are some restriction which prevent using one dll-file for both platform.


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

Valued Contributor
FRPT1257
Posts: 69
Registered: ‎05-03-2006
Message 3 of 10 (230 Views)

Re: AutoCAD 32bits and 64bits API

07-19-2014 02:43 AM in reply to: Alexander.Rivilis
What kind of restrictions?
I did an Addin with Inventor API and works perfect in both platforms.
Moderator
Alexander.Rivilis
Posts: 1,449
Registered: ‎04-09-2008
Message 4 of 10 (229 Views)

Re: AutoCAD 32bits and 64bits API

07-19-2014 02:49 AM in reply to: FRPT1257

FRPT1257 wrote:
What kind of restrictions?
I did an Addin with Inventor API and works perfect in both platforms.

For example, if you using third-party ActiveX/COM module which exist only for x86 but not for x64.

Also read: http://adndevblog.typepad.com/autocad/2012/06/where-did-my-interop-assemblies-go.html


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

Valued Mentor
AubelecBE
Posts: 394
Registered: ‎01-27-2010
Message 5 of 10 (192 Views)

Re: AutoCAD 32bits and 64bits API

07-22-2014 03:55 AM in reply to: Alexander.Rivilis

Yes. if you want use the same DLL for x86 or x64 dont use another dll. (on any CPU) for example :

if you have seven 32b with sqlserver ans another seven 64b witch sqlserver you cant have the same dll loaded in acad. the string connection is the same but you need to have code on x64 for x64 seven or x86 for seven x86.

 

you can but you need to install x86 install for sqlserver on the x64 seven. but i dunno if you can do that.

 

sqlserver is a example. i tryed to connect on a file XLS with a string connection (Database format) but i have to change the api and my code for this.)

Mentor
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 6 of 10 (172 Views)

Re: AutoCAD 32bits and 64bits API

07-22-2014 12:47 PM in reply to: FRPT1257

Inventor .NET API uses COM/Interop (Autodesk.Inventor.Interop.dll) which is Any CPU. Any .NET plugin which is built as Any CPU and references Any CPU .NET assemblies should work for all platforms (x86 and x64).


AutoCAD .NET API uses targeted platform (x86 or x64) for accoremgd.dll, acdbmgd.dll and acmgd.dll, as they heavily use unmanaged objects from native AutoCAD DLLs (x86 or x64). Your .NET plugin is Any CPU and it can reference both x86 and x64 .NET assemblies. Therefore, it may work on both platforms (AutoCAD 32 bits and 64 bits).


The restriction happens when your .NET plugin references a non-.NET assembly such as ActiveX/COM which was compiled from C++, and targeted by either x86 or x64. If your plugin references x64 ActiveX control, it cannot work on x86 machine, and vice versa.


We cannot reference an ActiveX control created by .NET to .NET plugins. Therefore, third-party ActiveX/COM libraries use in .NET plugins are compiled from non-.NET languages such as C++, VB… Those libraries are really care about 32 bits or 64 bits.


I don’t have AutoCAD 32 bit to test my Any CPU .NET plugins yet, as it requires Windows 32 bit. I am not sure all Any CPU plugins can work on AutoCAD 32 bit. As this topic is interesting so I want to point some ideas for further discussion.


Khoa

Valued Contributor
FRPT1257
Posts: 69
Registered: ‎05-03-2006
Message 7 of 10 (148 Views)

Re: AutoCAD 32bits and 64bits API

07-23-2014 01:21 AM in reply to: khoa.ho
Until now, in all tests I did my Addin and works well in both plataforms (x86 and x64).
My addin references are all to AutoCAD .DLLs and assemblies created by me.
Thanks & Regards.
Mentor
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 8 of 10 (129 Views)

Re: AutoCAD 32bits and 64bits API

07-23-2014 07:08 AM in reply to: FRPT1257

Thank you to confirm that your Any CPU addins work well on both x64 and x86 platforms. That makes me confident that I can deliver my addins to both 32 bits and 64 bits machines.

 

As long as we take care of the target platform of the addin and all its references, it should avoid the problem of 32 and 64 bits at the end users.

 

Valued Contributor
FRPT1257
Posts: 69
Registered: ‎05-03-2006
Message 9 of 10 (124 Views)

Re: AutoCAD 32bits and 64bits API

07-23-2014 07:21 AM in reply to: khoa.ho
The only issue is that I needed to compile 2 InstallPrograms. But this looks to be a VisualStudio limitation. All my Addin DLLs are the same for both platforms (compiled with “Any CPU” option), but since I have an install program I needed to compile one setup to x86 and other to x64.
Mentor
khoa.ho
Posts: 224
Registered: ‎09-15-2011
Message 10 of 10 (116 Views)

Re: AutoCAD 32bits and 64bits API

07-23-2014 08:11 AM in reply to: FRPT1257

You may try to use Inno Setup (free), Advanced Installer or InstallShield to have the mixed 32/64-bit all in one installer for two platforms.

 

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!