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

Using dll compiled to x86 CPU in Acad2010 64bit

6 REPLIES 6
Reply
Message 1 of 7
Paulio
954 Views, 6 Replies

Using dll compiled to x86 CPU in Acad2010 64bit

Guys,

My code uses OLDEB to connect to and read in data from an Excel spreadsheet and use it in Acad2010. This was all fine on my old 32 bit machine but now I've got a swanky new 64 bit one it doesn't work.

 

From Googling around it seems that there is no OLEDB for 64 bit (not that I could find anyway). Apparently the solution is to set the target CPU to x86 instead of Any but this then causes the netload of my dll to fail with the error "An attempt was made to load a program with an incorrect format."

 

I've tried running AutoCAD in compatibility mode for XP but no luck.

 

Does anyone have any ideas?

 

Thanks in advance.

6 REPLIES 6
Message 2 of 7
norman.yuan
in reply to: Paulio

You cannot run code compiled to x86 iin 64-bit Acad. Period.

 

I assume your code reads data from Excel sheet using MS Jet Oledb provider (so to be a bit clearer, it is not true that "there is no OLEDB for 64 bit", it is there is no 64-bit Jet engine, thus no 64-bit Oledb provider for it).

 

However, you can use the Jet replacement - MS Access  database engine, which has both 32-bit and 64-bit version, to read Excel sheet (and *.mdb.*accdb files), just as you do with Jet engine. It does not come with OS as Jet, you need to have Access2007/2010 installed, or you can downloaded (for free) from MS site. Once you installed it, you can use following ConnectionString:

 

Provider=Microsoft.ACE.Oledb.12.0; Data Source=[file path];Extended Properties=''Excel 12.0;HDR=YES"".

 

There difference here is you use "Microsoft.ACE.Loedb.12.0", instead of "Microsoft.Je.Oledb.4.0" and "Excel 12.0" instead of "Excel 8.0". Make sure you install 64-bit version of ADE engine.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 7

We stopped depending on the Runtime Distributables for Excel before the 64bit version came out, we switched to the "Open XML SDK 2.0 for Microsoft Office" where we don't require any special dependencies in our code. Here's the link to the MS website: http://msdn.microsoft.com/en-us/library/bb448854(office.14).aspx

Mike Robertson
FL. Dept. of Transportation
CADD Applications Developer
Message 4 of 7
Paulio
in reply to: norman.yuan

Thanks Norman

I guess my question should've been more 'is there a way to throttle back AutoCAD to run as 32bit on a 64 bit machine so it will load the dll'.

 

I know it won't run on 64 bit, I was just wondering if there was a workaround.

 

I've got office 2007 on this machine and I'm already using the "Microsoft.ACE.OLEDB.12.0" connection string but it's giving me the error: "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."

 

After a bit more Googling, the solution seemed to be to compile to x86 which led me to post my Acad question here in the first place.

 

I would've thought that having Office 2007 installed would be enough(?)

Message 5 of 7
Paulio
in reply to: michael.robertson

Thanks for that Michael, I'll take a look. Sounds like a better long term solution...

Message 6 of 7
Paulio
in reply to: Paulio

Update:

 

I thought I already had the AccessDatabaseEngine dirvers installed as recommended by Norman but it turns out they were the 32 bit version not 64.

 

So I downloaded the 64 bit versions but... it won't install it becuse I've got 32 bit office 2007 installed! I need to remove my office before I can install it!

 

Perhaps I should ask for my old machine back...Smiley Sad

Message 7 of 7
michael.robertson
in reply to: Paulio

Your running into the other problems we ran into when beta testing Office 2010, I couldn't confirm but it seemed like if we had any software that had vba installed, the 64bit Office components wouldn't install, thus the Open XML route we took. We only have one app right now converted to use it but it works great on both 32bit & 64bit versions of Civil3D 2011 (only one dll that works on both platforms).

Mike Robertson
FL. Dept. of Transportation
CADD Applications Developer

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost