Solved

making a dll file VS2010

Posted on 2012-03-26
3
453 Views
Last Modified: 2012-03-27
hello there,
I have downloaded a project source code in CPP using 64bit arch..
I would like to know if its possible to make this dll file work with 32bit as well..
how can I make it work?
0
Comment
Question by:XK8ER
3 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37769098
Have you tried going into the project properties and changing the target platform?
0
 
LVL 1

Author Comment

by:XK8ER
ID: 37769729
I have a win app that uses that specific dll..
when I run the app with Tager CPU "AnyCPU" it run and loads fine on 64bit arch
when I run the same app with the same dll on 32bit arc I get errors from dll..
is it possible to make one dll file work with both architectures ?
0
 
LVL 5

Accepted Solution

by:
Rainverse earned 500 total points
ID: 37771356
No. You can't use 64 bit DLLs in a 32 bit .Net application, or vice versa. That being said, I ran in to a problem like this and what I ended up doing wasn't elegant, but it worked. I have a 64 bit application that I needed to utilize 32 bit dlls for one part of a long process I was coding. What I did was create a 32 bit console app that did the 32 bit part of the process, and called that console app from the 64 bit application as a process. Below is my method for doing this:

   
Private Function exec32bitProcess(ByVal currArgs As String())
        Dim currProcess As New Process()
        Dim strResult As String = ""

        currProcess.StartInfo.FileName = "C:\myConsoleApp.exe"
        currProcess.StartInfo.UseShellExecute = False
        currProcess.StartInfo.CreateNoWindow = True
        currProcess.StartInfo.RedirectStandardInput = True
        currProcess.StartInfo.RedirectStandardOutput = True
        currProcess.StartInfo.Arguments = [String].Join(" ", currArgs)
        currProcess.Start()

        Dim sOut As StreamReader = currProcess.StandardOutput

        strResult = sOut.ReadToEnd()

        If Not currProcess.HasExited Then
            currProcess.Kill()
        End If

        sOut.Close()
        currProcess.Close()

        Return strResult
    End Function

Open in new window


Like I said, it's a hack, but it worked and it was the only way I found to use both 32 bit and 64 bit dll's in "one" process.

-MJC
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Limiting string to two deciamls 18 49
help with issues with ReportViewer in VS2015 5 37
Visual Studio - "Windows Form Designer generated code" 2 37
SQL syntax in VB.net 5 27
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now