Jump to content

DLL Heck

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
PGP_Protector

PGP_Protector

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 253 posts
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

#2
Davide

Davide

    Programming God

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

#3
PGP_Protector

PGP_Protector

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 253 posts

Davide said:

Rewrite it in C++

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

#4
Davide

Davide

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 506 posts
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.
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#5
PGP_Protector

PGP_Protector

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 253 posts
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 ?

#6
Davide

Davide

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 506 posts
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#.
Are you a newbie programmer trying to learn C#? Check out my small tutorial: Visual C# Programming Basics

#7
PGP_Protector

PGP_Protector

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 253 posts

Davide said:

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.