473,386 Members | 1,647 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,386 software developers and data experts.

Upgrading a C DLL to a .NET Library

Hi,

I have a C DLL which i would like to import into my .NET service.
a) How do I convert the DLL so as to be refernced by a .NET service (I don't want to use PInovke)
b) I tried recreating the DLL in VS.NET as a VC# Class Library but I get this error - decleration of dllimport function not allowed.

Help!
Nov 16 '05 #1
4 1007
GeRmlc,

You can not do this. If you want to access functionality from a DLL
that exports functions, then you will have to go through the P/Invoke layer.

The other option is to rewrite the code in a managed language.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"GeRmIc" <an*******@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
Hi,

I have a C DLL which i would like to import into my .NET service.
a) How do I convert the DLL so as to be refernced by a .NET service (I don't want to use PInovke) b) I tried recreating the DLL in VS.NET as a VC# Class Library but I get this error - decleration of dllimport function not allowed.
Help!

Nov 16 '05 #2
Hi Nicholas

Thanks, I'm now basically porting(copying with some minor modifications) the whole DLL to Visual C++ MFC ISAPI Extension DLL, Hoping I could then integrate that DLL into my .NET application but i keep getting this erro

'definition of dllimport function not allowed', i've tried prefixing _declspec(dllimport) to the function declarations but still..

Any advice? Thank

----- Nicholas Paldino [.NET/C# MVP] wrote: ----

GeRmlc

You can not do this. If you want to access functionality from a DL
that exports functions, then you will have to go through the P/Invoke layer

The other option is to rewrite the code in a managed language

Hope this helps
--
- Nicholas Paldino [.NET/C# MVP
- mv*@spam.guard.caspershouse.co
Nov 16 '05 #3
=?Utf-8?B?R2VSbUlj?= <an*******@discussions.microsoft.com> wrote in
news:F2**********************************@microsof t.com:
Thanks, I'm now basically porting(copying with some minor modifications)
the whole DLL to Visual C++ MFC ISAPI Extension DLL, Hoping I could then
integrate that DLL into my .NET application but i keep getting this
error

'definition of dllimport function not allowed', i've tried prefixing
_declspec(dllimport) to the function declarations but still...


You are treating C# like C++ - its totally different. Only the general syntax
is the same.

DLL's are unmanaged code - you cannot just simply import them into managed
code. You need to use P/Invoke which will create a bridge from your managed
code to the unmanaged DLL.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 16 '05 #4

"GeRmIc" wrote :
Hi,

I have a C DLL which i would like to import into my .NET service.
a) How do I convert the DLL so as to be refernced by a .NET service (I

don't want to use PInovke)

Hello,

Why don't you want to use PInvoke ?

--
Francois Beaussier
Fr******@3ie.org.remove
Nov 16 '05 #5

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

Similar topics

2
by: wellington fan | last post by:
Dear newsies, My ISP has offered to upgrade my servers from 3.23 to 4.1. I'm excited by the potential gains in performance, and the ability to write subqueries, but am wary of any forward...
4
by: Crispin Horsfield | last post by:
Hi I want to update some CGI-BIN routines driven from <b>Classic</b> ASP that I wrote in VB6. There are a number of criteria controlling what I'm doing: 1. I don't want to rewrite the Classic...
5
by: Mike Owen | last post by:
Hi, I have just used the import Wizard to import a VS 2003 app to VS 2005. I have a lot of work to do to enable it to compile successfully with all the errors and warnings it gave me, but as a...
11
by: Aidan Tobin | last post by:
Hi, I have to upgrade a number of databases from Access 2.0, Access 97 and Access 2000 to work in Office 2003. These databases contain a number of Forms coded with VBA as well as a number of...
1
by: progTiger | last post by:
The upgrade wizard just hangs on step 5 of 5 when it reaches "Upgrading DataEnvironment..." I have let it sit for 3 hours and it does nothing. .Net Studio is not frozen, but the process does...
15
by: Asaf | last post by:
Hi, I have received a source code project written in C++ VS.NET 2003 on .NET 1.1 that compiles without a problem. I have opened this source code in VS.NET 2005 and the Log wizard says that...
8
by: Smartin | last post by:
My Company is planning to upgrade MSOffice from 97 to 2003 this year. We make fairly extensive use of Access 97 databases to support departmental needs, having on the order of 50 MDB's in regular...
6
by: JimLad | last post by:
Hi, We have a major ASP app that we are in the process of upgrading to ASP.NET 1.1 and probably on to ASP.NET 2.0 in the middle of next year. (We will also be upgrading to SQL2K5 at the same...
7
by: sierra7 | last post by:
Hi Guys I'm finally converting some old Access 97 stuff to 2003 and as you know part of this procedure is to explicitly qualify Database, Recordset and TableDef objects as DAO. When I have done...
2
by: Michael Howes | last post by:
I am trying to upgrade a large asp.net application from .Net 1.1 to ..Net 3.0 I'm getting an error when connecting to the database now that the app runs as a .Net 3.0 application. the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.