|
When I try to add the generated dll file, the visual studio didn't accept the dll file..
plz reply asap..
thnx in advance..
code for dll
--------------
#include <stdio.h>
extern "C"
{
__declspec(dllexport) void DisplayHelloFromDLL()
{
printf ("Hello from DLL !\n");
}
}
___________________________________________________________
code for C# program
--------------------
class HelloWorld
{
[DllImport("TestLib.dll")]
public static extern void DisplayHelloFromDLL ();
static void Main ()
{
Console.WriteLine ("This is C# program");
DisplayHelloFromDLL ();
}
}
______________________________________________________
|
|
|
|
|
Everything looks ok, are you sure the dll is where your program can find it? Also, you do not add it as a reference like normal .NET assemblies.
|
|
|
|
|
Perhaps your exports aren't correct. Try adding them explicitely to your .def file.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi
I have an enumerated type that has two elements : fixed and floating, but I can't use "fixed" because it is an identifier.
Any ideas how I get around this?
|
|
|
|
|
If you want to use a reserved word for that kind of thing you need to put an @ in front of it
enum MyEnumeration
{
@fixed,
floating
}
...
Console.WriteLine(MyEnumeration.@fixed.ToString());
|
|
|
|
|
5'd, but please see note below.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Thanks. 'tis thus resolved.
|
|
|
|
|
In addition to what Colin said, I would almost never recommend it. It's bad practice, and it throws people off the track. Not many people even know about this. IMO, this feature should have been left out.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
I agree that it's dangerous, but since C# keywords != VB keywords != C++ keywords != python keywords != cobol keywords, etc; the CLR needs to have a way to handle something not a keyword in the language it was written in but that is one in a different language that wasn't considered when the class was originally written.
You know, every time I tried to win a bar-bet about being able to count to 1000 using my fingers I always got punched out when I reached 4....
-- El Corazon
|
|
|
|
|
Excellent, thanks. I stand corrected on the "This feature should have been left out" bit.
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Both Colin and Vikram are correct. It is possible to do by prefixing the enum field with the "@" symbol but it really is not recommended.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Good Day,
Ever since I've used DLL files, I'm always plagued by the problem of detecting whether they exist or not.
For example, A.exe uses A.dll , and then I delete A.dll then run A.exe
A.exe will run successfully even if A.dll does not exist, it will however crash when some function from A.dll was called.
Is it possible to display "Cannot find A.dll. Application will now close." message?
I don't want to use File.Exist("A.dll") in Program.cs, is there any other way to accomplish the task?
Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
If the DLL is optional, you could catch the exception that is thrown when the DLL is not present.
|
|
|
|
|
Thanks for the reply.
What if the DLL is really really needed? And I want to throw an exception before the main form starts (in program.cs)?
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
Ian Uy wrote: What if the DLL is really really needed?
I thought your situation was that the DLL already is NOT there!
Ian Uy wrote: And I want to throw an exception before the main form starts (in program.cs)?
You could try loading all the DLLs you need at the beginning using Assembly.Load(), I suppose....
Cheers,
Vikram.
The hands that help are holier than the lips that pray.
|
|
|
|
|
Vikram A Punathambekar wrote:
You could try loading all the DLLs you need at the beginning using Assembly.Load(), I suppose....
Yup, after searching Google, I stumbled upon this solution. I am using Assembly.LoadFrom inside a try-catch block.
Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
Hi has anyone everbeen able to publish updates to wsus / 3 ?
There is an API but I haven't been able to find any good/usefull documentation/instructions .
I think this will be a usefull article if anybody knows how it works .
|
|
|
|
|
I am connecting to an MS Access Database with one of the tables containing an image field (OLE)
When I created a report that display that image, I faced 2 problems:
1- The resolution of the image turned very bad. So, how to control this?
2- How to adjust the image size to dynamically display proportional height and width that fit on A4 paper?
Mohammed Gouda
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
Attention Here .. Please
Mohammed Gouda
foreach(Minute m in MyLife)
myExperience++;
|
|
|
|
|
|
Hello,
in an application developped via ASP. if i run a table it take about 1 seconde to get the result.
but running the view of the corresponding table take about 3s.
Note : the view contain a complexe query.
So from where to get data from table or view in order to optimize my search.
best regards
dghdfghdfghdfghdgh
|
|
|
|
|
|
Its your choice really. If the table contains all the data you need and its quicker, use it. If not, use the view.
The only real way to tell is to benchmark the time it takes to do whatever you need to do with the data.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi all,
i got problem in replacing text in richtextbox with new text.
I using find and replace method,but it doesnt work..
The text will load in richtextbox when i run the system.Wht i need is just replace some text with new text in richtextbox..
Pls help me..
Thank You..
%#&kmpYrlHSGYG5@#($_+!@!(*JASnjshdk,cm_0ashjhdbn@#$!48mkhfbchsh))^%#W%&@YW7wsdfjw789';'][]\`~JKJQ4$!@#~)-HSKS^&*1)JK12@#@$~!1`DFGkqp][]\]?Zas;EWRG%!@~)(^&BVAG
|
|
|
|
|
And what is not working? What do you use to find and then replace? Show some code.
|
|
|
|