Solved

making a dll file VS2010

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

777 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