Jump to content




Recent Status Updates

  • Photo
      18 Aug
    KodeKool

    When faced with a wall of errors and no hope to fix them, remember the following "Programs always do what you tell them to, and seldom what you want them to, but eventually you'll run out of things that can go wrong and it'll just work. and that's the secret to good programming."

    Show comments (2)
View All Updates

Developed by Kemal Taskin
Photo
- - - - -

DLL Heck


  • Please log in to reply
6 replies to this topic

#1 PGP_Protector

PGP_Protector

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 225 posts

Posted 26 May 2010 - 01:48 PM

Ug.

OK, I need a bit of Direction :)

I've Got A .NET DLL That I've written in C#
I can call it in .NET VB / .NET C++ / .NET C# Without Issue.
It uses System.IO.Pipes To Communicate to the main Program (I believe Pipes Requires NET 3.5)

Now for the problem :cursing:

The Person Using the DLL in their Application Wants to use VC++ 6.0 without using any .NET Environments.

What / How do I make it available to them They're looking for an Unmanaged.DLL
  • 0

#2 Davide

Davide

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 484 posts

Posted 27 May 2010 - 05:56 AM

Rewrite it in C++
  • 0
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#3 PGP_Protector

PGP_Protector

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 225 posts

Posted 27 May 2010 - 11:41 AM

Rewrite it in C++


Will a DLL using .NET 3.5 written in C++ be usable by Visual C 6.0 ?
  • 0

#4 Davide

Davide

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 484 posts

Posted 27 May 2010 - 01:04 PM

If it's not using .NET, it's just C++, not Visual C++. Writing it in C++ means NOT using the .NET framework to write it, but native C++ with Win32 API and similar stuff.

DLL made for .NET can be used with .NET.
Native DLL can be used with native code (C++) and with .NET using [DLLImport("dllname.dll")].

They are different, but they have the same extension.
  • 0
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#5 PGP_Protector

PGP_Protector

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 225 posts

Posted 28 May 2010 - 09:28 AM

ok, My C++ Is very Limited
In My .h File If I understand C++ Correctly This is where I would "define" the commands that are used correct ?
So For Example the User (in the C# Version ) Has two Commands

  • public static int SendConfig(string[] TestConfigurationReceived)
  • public static double[,] RunTest(int TestParamater1,int TestParamater2)
with the Code to Either Get The Users Configuration, or Run the Test defined for the Commands in C#, This works as expected.

Now to Do This In C++ I've got 2 Files the MyDLL.cpp & the MyDLL.h Files (Pulled from a "Create a DLL in C++ Demo I found)

They have their functions "Defined" in the .h file like this.

  • static __declspec(dllexport) double Divide(double a, double B);
Then in the .cpp file like this
double MyDLL::Divide(double a, double b)
    {
        if (b == 0)
        {
            throw new invalid_argument("b cannot be zero!");
        }

        return a / b;
    }

So How do I define it in the .h file to receive an unknown size array, and return an unknown size array in the .H & .CPP Files ?
  • 0

#6 Davide

Davide

    CC Devotee

  • Senior Member
  • PipPipPipPipPipPip
  • 484 posts

Posted 28 May 2010 - 09:33 AM

I'm not really good at C++ when it comes to classes. But I doubt you can declare an unknown size array in either C# or C++. You can declare a list though in C#.
  • 0
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#7 PGP_Protector

PGP_Protector

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 225 posts

Posted 28 May 2010 - 09:47 AM

I'm not really good at C++ when it comes to classes. But I doubt you can declare an unknown size array in either C# or C++. You can declare a list though in C#.


This works for me in C# for

double[,] TempResultsBuffer = null;
TempResultsBuffer = DataParser(MyData);
return TempResultsBuffer;
[code]

Where DataParser is a function like this
[code]
private static double[,] DataParser(RawData)
{
// Process raw Data and Return a double[,]
}

But thanks for the pointers (Note I'd love to avoid using C++ * Pointers if possible :D )

Back to Google & my books for now.
  • 0