473,320 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Calling unmanaged DLL - have distinct versions of dll

Joe
Hi

I have this working but was just curious if there was a cleaner way of doing
this??

I have a dll that is versioned thru the dll name and I need to support both
versions.
The fcts within the dll are the same for now but who knows in the future.

I need the 2 classes to wrap the unmanged dll. It seems the two classes to
call the managed dll should be
different because calling to the static fcts with the Class names is
claener. If I had interfaces - I could combine these 2 classes
but this seems the best way that I know of ???

Just curious
Thanks
public class MyClass

{

[DllImport("mydll.dll", EntryPoint = "putString")]

public static extern Int16 putString(Int32 nPat, Int16 fieldType, Int16
occurrence, [MarshalAs(UnmanagedType.LPStr)] StringBuilder data);
}

public class MyClassv2

{

[DllImport("mydllv2.dll", EntryPoint = "putString")]

public static extern Int16 putString(Int32 nPat, Int16 fieldType, Int16
occurrence, [MarshalAs(UnmanagedType.LPStr)] StringBuilder data);
}

public class TestDll

{
public TestDll()

{

int rc = 0;

rc= MyClass.putString(1, 1, 1, "Some Text");

}

}

public class TestDll2

{
public TestDll2()

{

int rc = 0;

rc= MyClassv2.putString(1, 1, 1, "Some Text");

}

}
Aug 7 '06 #1
0 869

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that...
2
by: Stephen Walch | last post by:
When my managed C++ application calls standard C functions like strncmp and malloc, am I making an expensive transition between managed and unmanaged code? If so, are there alternate "pure...
1
by: Jesse McGrew | last post by:
Hi all, I'm trying to make a plugin DLL for a third-party application, using VC++ .NET 2003. This DLL acts as a bridge between the C++ plugin API of the application, and my actual plugin code...
3
by: Gustavo L. Fabro | last post by:
Greetings! I'm a newbie in Visual C++ .NET (have programmed in Borland C++ and Builder for long) and I am trying to do a very simple thing, but I'm stuck. I created an (unmanaged) DLL project...
1
by: H.B. | last post by:
Hi, I need to make a function that can display data on my Managed C++ app and be called by an unmanaged C++ DLL. Something like : void Form1::Form1_Load(System::Object * sender,...
0
by: monika.saxena | last post by:
Hi all, In one of my projects which is a web based application in asp.net, a third party tool - "Frontline Solver DLL" (It is an unmanaged DLL and ..NET is calling it using the PInvoke) is used....
1
by: Mike Walsh | last post by:
Hi All, I have an unmanaged C++ DLL built in Visual Studio 4.2. This DLL exports a class, which I want to use in my VC++ .NET 2003 app. Everything works fine however some of the methods in the...
4
by: andrewcw | last post by:
Can someone suggest a way to get the functions to match - I am trying to get file versions, etc info. But its still in unmanaged code as far as I can find. VGetFileVersionInfoSizeA' has unbalanced...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.