Solved

making a dll file VS2010

Posted on 2012-03-26
3
446 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

747 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

10 Experts available now in Live!

Get 1:1 Help Now