Solved

making a dll file VS2010

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 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