C++ Standards, Extensions, and Interop


Deployment after #import 'ing dlls; C++ VS2010


Hello,
Apologies if I this isn't the correct thread for my question - please can you redirect me if appropriate?
I have written a small addin for excel that #imports some excel related typelibs:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// MS OFFICE LIBRARY
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#import "C:\Program Files\Common Files\Microsoft Shared\Office10\mso.dll" \
rename("RGB", "MSRGB")
using namespace Office;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// MS VBE EXTENSIBILITY OBJECTS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#import \
"C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\vbe6ext.olb"
using namespace VBIDE;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// MS EXCEL OBJECTS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#import "C:\Program Files\OfficeXP\Office10\EXCEL.EXE" \
auto_search auto_rename \
exclude("IFont", "IPicture")
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// VBA OBJECTS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.dll" \
auto_search auto_rename
I then proceed to use these object models in the dll - it all works smoothly on my machine. But I don't seem to be able to deploy successfully...
I was under the impression that I only need to deploy the generated dll, but this seems to be insufficient (I won't bore you with the details, but after declaring the functions in VBA , it complains that it's unable to locate the dll on other people PCs)
Does anyone have any idea about what I am missing? It looks like something got registered during compilation on my machine, but what? It can't be these libraries, they are definitely registered on the machine I am trying (and failing...)
Please lend a hand, I'm close to deployment time, ...nothing to deploy so far!
Thanks vm,
Yiannis
If you specify /MT (instead of /MD) then you will statically link with the CRT, so you won't need to rely on CRT DLLs on the client machines.
As has already been mentioned by Brian, #import only lets the compiler figure out what all the entry points are, it doesn't actually include the DLL into the final image.
You can use depends.exe to help identify which DLLs a binary relies on, but can't be found on the system. KP198038 is dated but still applicable.Microsoft Test - http://tester.poleyland.com/
Note that you can only deploy this on machines that have a licensed copy of Microsoft Office Excel installed. Make sure that you are building only the RELEASE version, not the DEBUG version. Finally, install the
VS2010 C++ Redistributable on the target machine.
Hi Brian,
Thanks vm for your quick reply.
1) The target machine has as licenced copy of excel installed
2) I a using a release version
3) Might be the problem. I did not realize this could be an issue. What type of files does the dll make use of on the target machine? Is there a version of VS10 that is guaranteeed to work with XP without requiring installation of the redistributables? I
have a wide client base, this can be a significant problem...
Regards,
Yiannis
If you specify /MT (instead of /MD) then you will statically link with the CRT, so you won't need to rely on CRT DLLs on the client machines.
As has already been mentioned by Brian, #import only lets the compiler figure out what all the entry points are, it doesn't actually include the DLL into the final image.
You can use depends.exe to help identify which DLLs a binary relies on, but can't be found on the system. KP198038 is dated but still applicable.Microsoft Test - http://tester.poleyland.com/
I agree with Josh. I suspect using /MT would be sufficient in most cases. Otherwise consider building an MSI for deployment purposes. The Setup and Deployment project template could be one way.
Deployment is a pretty big topic, actually, and is often overlooked by developers until the shipping date starts looming.
Thanks guys, this is being very helpful.
I will try the /MT switch.
I was looking at distribution documentation on MSDN:
Redistributing Visual C++ Files
Determining Which DLLs to Redistribute
Walkthrough: Deploying a Visual C++ Application to an Application-local Folder
(the last one containing a relevant deployment example)
I wonder, will the dll lookup rules apply in this case?
i.e. can the redistributables be in the current directory?
Dynamic-Link Library Search Order
In my case, I essentially wrote an excel addin, so I suppose I would have to copy the files to everyones excel folder otherwise (permissions being another potential nightmare)
Regards,
Yiannis
Try the /MT switch first, as that may solve your problems. The redistributables won't be necessary in this case.
How to Deploy C++ Properly
Deployment (C++)
How
to redistribute the Visual C++ Libraries with your application
Windows Installer
Deploying .NET Framework Applications
Determining Which DLLs to Redistribute
Example: Installing your app and .NET Framework using INNO Setup
How to: Deploy using a Setup and Deployment Project
And solve the problems it did! Thanks again for sorting me out.
Regards,
Yiannis

Related Links

how to get IE Browser Handler(hwnd)
ActiveX Deployment: VC 2005 Redistributable Issues
LNK2001 ?
AFX_MANAGE_STATE() macro disturbs the startup position of the ATL dialog
how to change the "Language support for non-Unicode language" in VC
STL vector sizing question
Using Direct2D how would i fill a font with a gradient or radial brush?
Beginner c++ question--Bitwise enumerations
int i = 2; Is this the Assingment Operator here ?
How do you define a template class's constructor outside the class
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
How to use another variable from another Form in VisualC++
Accessing a member through a pointer
How to copy one char* array into another one?
definition of dllimport static data member not allowed
LockFile problem

Categories

MSDN
Microsoft Azure
Visual Studio Design a...
SQL Server (Pre-release)
Orchard
Unified Communications
Expression
Project
Microsoft Azure
Kinect for Windows SDKs
Archived Forums
Visual Studio Tools fo...
Register and Manage Ac...
Windows Desktop Perfmo...
Excel for Developers
SharePoint 2013 - Setu...
SharePoint Legacy Vers...
Service Bus
Azure Active Directory
Azure Multi-Factor Aut...
Azure BizTalk Services
Azure Networking (DNS,...
Azure Analysis Services
Claims based access pl...
BizTalk ESB Toolkit
LINQ to SQL
HealthVault Developer
JScript Native
Internet Explorer Web ...
Visual Basic for Appli...
Small Basic
SyncFx – Microsoft Syn...
.NET Compact Framework
Transact-SQL
SQL Service Broker
SQL Server Documentation
Microsoft Drivers for ...
SQL Server Search
Microsoft StreamInsight
Standard 7: Servicing ...
Windows Forms Data Con...
CRM Deployment
Speech Service for Dev...
Bing Maps REST, SOAP, ...
Silverlight 5
Getting Started with S...
Programming Silverligh...
PivotViewer Control wi...
Expression Media
.NET Framework Network...
Building Windows Store...
Building Windows Store...
Core Coding Experience...
Doloto
LINQ to SQL (Pre-Release)
Microsoft Security Dev...
Office Development wit...
POS for .NET
Search Server: Develop...
Server Core Developers
Storage Platform – ATA
SQL Server 2014 Analys...
SQL Server 2014 Setup ...
Team Foundation Server...
Visual Basic 2008 (Pre...
Visual C# 2008 (Pre-re...
Visual C# IDE
Visual Studio Lab Mana...
Web Sandbox - Exploits
Windows Live Alerts De...
Reporting
Windows Phone Preview ...
Windows Phone Preview SDK
OneDrive Development (...
Skype Web SDK

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile