Addin compiled to 64 bits platform with Excel 32 bits

425 views
Skip to first unread message

Sebastian

unread,
Oct 3, 2014, 4:23:15 PM10/3/14
to exce...@googlegroups.com
Hello All,

Is it possible to load and register exlcel dna addin that is compiled as x64 bits (for some reasons)  to excel 32bits ? I use library ExcelDna.xll   32bits ..
It is important for me, please help

Regards,
Sebastian

Govert van Drimmelen

unread,
Oct 3, 2014, 4:30:01 PM10/3/14
to exce...@googlegroups.com
Hi Sebastian,

No, it's not possible.
Windows cannot a load a 64-bit dll into a 32-bit process.

-Govert


From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of Sebastian [zawa...@gmail.com]
Sent: 03 October 2014 10:23 PM
To: exce...@googlegroups.com
Subject: [ExcelDna] Addin compiled to 64 bits platform with Excel 32 bits

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.

Sebastian

unread,
Oct 4, 2014, 2:53:17 AM10/4/14
to exce...@googlegroups.com
Hi Goovert,

And when addin it will be compiled to "Anu Cpu" ?
 


W dniu piątek, 3 października 2014 22:30:01 UTC+2 użytkownik Govert van Drimmelen napisał:
Hi Sebastian,

No, it's not possible.
Windows cannot a load a 64-bit dll into a 32-bit process.

-Govert

From: exce...@googlegroups.com [exce...@googlegroups.com] on behalf of Sebastian [zawa...@gmail.com]
Sent: 03 October 2014 10:23 PM
To: exce...@googlegroups.com
Subject: [ExcelDna] Addin compiled to 64 bits platform with Excel 32 bits

Hello All,

Is it possible to load and register exlcel dna addin that is compiled as x64 bits (for some reasons)  to excel 32bits ? I use library ExcelDna.xll   32bits ..
It is important for me, please help

Regards,
Sebastian

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exc...@googlegroups.com.

Govert van Drimmelen

unread,
Oct 4, 2014, 3:41:11 AM10/4/14
to exce...@googlegroups.com
Hi Sebastian,

The .xll files are native code dynamic-link libraries. They are bitness-specific, so there is a 32-bit ExcelDna.xll and a 64-bit ExcelDna64.xll. These can only load in the matching Excel process type.

The add-in is composed of your .NET code and the .xlls. Your .NET code or other .NET libraries might be compiled to AnyCpu, and might then be incorporated into both a 32-bit or a 64-bit add-in without recompiling. But the .xlls will still be different.

-Govert







Sent: 04 October 2014 08:53 AM
To: exce...@googlegroups.com
Subject: Re: [ExcelDna] Addin compiled to 64 bits platform with Excel 32 bits

To post to this group, send email to exce...@googlegroups.com.

Sebastian

unread,
Oct 4, 2014, 4:11:01 AM10/4/14
to exce...@googlegroups.com
Hi Govert,

Thanks for explanation.
So, if my addin will be compiled to Any Cpu, could be registered both 32 and 64 bits Excel, but always have to be used appropriate xll - the same bitnesse as Excel

Sebastian

unread,
Oct 5, 2014, 3:01:08 PM10/5/14
to exce...@googlegroups.com

Hello Govert, hello all,

Seems that addin compiled to Any Cpu platform working fine, could be registered in Excel 32 and Excel 64,  using right xll version.

I have one more question.  Is it possible to have both xll files in one folder and switch it changing content dna file? 

For example in one directory I will have structure :

MyProgram32-Addin.xll   - for registering with Excel 32 
MyProgram64-Addin.xll   - for registering with Excel 64 
MyProgram-Addin.dna    - dna file
MyProgram-Addin.dll  - my addin
Strater.exe

Strater.exe will be simple application that detect with excel is installed and properly modify dna file that  right xll file will be used. 

Is  solution some like this possible ?

Regards,
Sebastian

Govert van Drimmelen

unread,
Oct 6, 2014, 4:21:39 AM10/6/14
to exce...@googlegroups.com

Hi Sebastian,

 

It is not the .dna file that decides which .xll file to use, but the other way around – the .xll file is loaded by Excel, and it looks for a matching .dna file to decide what to do. Since the .dna file must have a name matching the .xll file, you’ll need separate .dna files for the 32-bit and 64-bit versions.

 

With ExcelDnaPack you can put the .dna files (and the MyProgam-AddIn.dll) inside the .xlls, so you only end up with the two .xll files to deal with.

 

If you want to make a “Starter.exe” like you describe, it could just rename the appropriate version of the .xll file to MyProgram-AddIn.xll, matching the .dna file, and then load it in Excel.

 

-Govert

To post to this group, send email to exce...@googlegroups.com.

Sebastian

unread,
Oct 6, 2014, 5:08:22 AM10/6/14
to exce...@googlegroups.com
Hi Govert,

Thanks for quick replay.

Yes, I considered renaming file, but these files will be deployed on customer PC to "Program Files" using setup and I suppose not enough rights to renaming, creating (now I see that editing too) files.
So, I think,  setup have create static folder/files structure and Starter.exe after detecting excel bitnesse,  choose right folder with xll.

I tried following approach :

DNA32   - folder with 32 xll
    |_ MyProgram-Addin.xll
    |_ MyProgram-Addin.dna
DNA64
    |_ MyProgram-Addin.xll
    |_ MyProgram-Addin.dna

MyProgram-Addin.dll  - my addin
...
...  some others dlls that are referenced by MyProgram-Addin.dll
...
Strater.exe

Starter.exe  has some logic and choose DNA32 or DNA64 depend excel bitnesse.   In MyProgram-Addin.dna  are used relative paths to addin :

<ExternalLibrary Path="MyProgram-Addin.dll"  LoadFromBytes="true" Pack="true" />

but without success..  Excel can't  load addin.

Are relative paths supported in dna files ?    Maybe you have any idea with another approach  ?


Regards,
Sebastian

Sebastian

unread,
Oct 6, 2014, 8:50:11 AM10/6/14
to exce...@googlegroups.com
Hi Goovert,

Ive just found that is enough  to have these xll and dna files with different names in my program root directory , e.g.  MyProgram-Addin32.xll  with MyProgram-Addin32.dna  and analogically for 64, and next Starter.exe use right xll file.
This solution should not  make problems ?
Reply all
Reply to author
Forward
0 new messages