?
Solved

making a dll file VS2010

Posted on 2012-03-26
3
Medium Priority
?
495 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 2000 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

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
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…
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…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

864 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