473,396 Members | 2,111 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,396 software developers and data experts.

How called the dll(written by c++)by c#?

Um,i search the problem through the internet.There is a code in *.cs:
using System.Runtime.InteropServices;
[DllImport("Test.DLL", EntryPoint="TestOne")]
public static extern bool TestOne(string src);
So,we can call the TestOne function.
But there is no DllImport() funtion,so can't execute the code.
Can someone tell me how can i do?
Thanks
Bruce Chen

Aug 13 '07 #1
2 1099
Bruce,

Are you getting a compiler error or a runtime error?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Br**********@gmail.comwrote in message
news:11*********************@q3g2000prf.googlegrou ps.com...
Um,i search the problem through the internet.There is a code in *.cs:
using System.Runtime.InteropServices;
[DllImport("Test.DLL", EntryPoint="TestOne")]
public static extern bool TestOne(string src);
So,we can call the TestOne function.
But there is no DllImport() funtion,so can't execute the code.
Can someone tell me how can i do?
Thanks
Bruce Chen

Aug 13 '07 #2
Thanks Nicholas
I create a new project of ClassLibrary,and there is no errors in it.
This is the following code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace testlib
{
public class enterdll
{
[DllImport("Adv.dll", EntryPoint = "OnOpendevbutton",
ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]

public static extern void OnOpendevbutton();

}

}
and i put the adv.dll(it's in bin folder) in another project not in
the ClassLibrary project.
There is a error(can't find the 'OnOpendevbutton' EnterPoint in
'Adv.dll'.) when i debug the project.
By the way,there are some function(i want to call them by donet),and
include the OnOpendevbutton() function.
So, what i can do?
Thanks

Aug 14 '07 #3

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

Similar topics

1
by: Tobias | last post by:
Need help: In Visual C++ 6 there was a feature "function called by" which could be reached by right-mouse-button-clicking on a function in the class view. I can't find the feature in .NET. Does it...
11
by: Douglas Peterson | last post by:
I have a simple class that verifies some data between the beginning and the end of a function: class Verify { Verify() { note the data value } ~Verify() { check if data value is the same as we...
23
by: David Frank | last post by:
How can I write a string function that encloses the input string in quotes "string" ?? below works for the "123 operation but adding " to it clobbers the "123 main() { char...
0
by: cato | last post by:
Urge you someone has application to decode a dll written in c ++ atte gbarahona chile
1
by: Konrad Kataneksza | last post by:
Hi, I have written COM in C#. This COM is called by an application written in Delphi 5. I want to be able to debug my COM when it is called by mentioned application. MS Visual Studio runs...
0
by: Jorge Luzarraga Castro | last post by:
Hi, I´ve a .Net DLL which generates and saves a XML File. This DLL is called by an ASP Classic application which uses this line to do it: Set ObjetoMirror = Nothing Set ObjetoMirror =...
2
by: Masita | last post by:
hi all, I am new in dot net development. Can windows dll called by any Web Application ? if i developing web application, can i just called my existing windows dll ? hope anyone can post...
1
by: sudermatt | last post by:
This one is completely baffling. DB Enviornment: MSSQL database Code Environment: ASP / VBscript (obviously) Problem: data from an nText field disappears from conn.execute(sql) recordset. ...
1
by: Jerry West | last post by:
Is it possible, using VB.NET to create a DLL that can be called by a C# EXE? JW
1
by: Keith G Hicks | last post by:
I created a dll in vb.net to calclulate the height of a block fo text as follows: Imports System.Drawing Imports System.Math Public Class DlnpFntCalcs Public Function GetTextHeight(ByVal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.