Generate a win32 usable dll with .NET?

R

Rainer Queck

Hi NG,

is it possible - and if yes, how? - to write a "win32 DLL" with the .NET?
I have a win32 application for which "exprets" can be provided. These
experts must be a win32 DLLs.

I would like to write such an expert, but don't know, what to do, that it
can be used as a nwin32 DLL.

Regards
Rainer Queck
 
A

Arne Vajhøj

Rainer said:
is it possible - and if yes, how? - to write a "win32 DLL" with the .NET?
I have a win32 application for which "exprets" can be provided. These
experts must be a win32 DLLs.

I would like to write such an expert, but don't know, what to do, that it
can be used as a nwin32 DLL.

A .NET DLL and a Win32 DLL is two very different things.

The C++ compiler in Visual Studio.NET can generate Win32 DLL's,
but that is not really .NET.

And you can not do it in C#.

You can create a wrapper in C++ that calls your C# code, but
then I would say it starts to become overly complex.

Arne
 
P

Pavel Minaev

Hi NG,

is it possible - and if yes, how? - to write a "win32 DLL" with the .NET?
I have a win32 application for which "exprets" can be provided. These
experts must be a win32 DLLs.

I would like to write such an expert, but don't know, what to do, that it
can be used as a nwin32 DLL.

You can do this in .NET with C++/CLI. Here's the article explaining
how to export managed functions from a C++/CLI DLL as native exports
(note that it automatically takes care of CLR initialization and so
on):

http://www.heege.net/blog/PermaLink,guid,48daf2ff-41c8-4312-9d80-bdfa8c55058d.aspx

I do not think you can do this with pure C#, though you could probably
fix-up the generated assembly the same way C++ compiler does to add a
native export table to it.
 
R

Rainer Queck

Hello Arne, Peter and Pavel!

Thanks to your answers. My conclution now is, that it will be way easier to
reactivate my "old" Delphi5 IDE and extend on of my already existing
"experts" - Peter you were right, it is kind of a add-in - to do what I need
to do.

Thanks to your hints and comments.

Regards
Rainer
 
S

soul.mirror1

A .NET DLL and a Win32 DLL is two very different things.

The C++ compiler in Visual Studio.NET can generate Win32 DLL's,
but that is not really .NET.

And you can not do it in C#.

You can create a wrapper in C++ that calls your C# code, but
then I would say it starts to become overly complex.

Arne

Arne Vajhøj, I hold up a mirror to your soul!

Your debut on Usenet in October 1992 was a good one, as you quickly
became a fount of helpful posts in comp.os.vms, for instance this one:

http://groups.google.com/group/comp.os.vms/msg/08b3af79deef9c6c?dmode=source

As time passed, you continued to make helpful posts, at first
primarily to comp.os.vms and comp.lang.c, later primarily to
microsoft.public.dotnet.languages.csharp and
comp.lang.java.programmer. Unfortunately, you also started a gradual
metamorphosis into a brusqe and unpleasant personality, increasingly
lacking patience for what you perceived as "dum" [sic] questions. An
example of one of your flames, dating to 2002, is:

http://groups.google.com/group/comp.os.vms/msg/5ea4d2984b05f698?dmode=source

This attitude change became more and more pronounced as the 21st
century continued. This fairly recent post of yours is a good example,
and scarcely more literate than the one from 2002:

http://groups.google.com/group/comp.lang.java.programmer/msg/86235bd045d1e86a?dmode=source

A particular affectation of yours is to order people to "try read"
something, usually the documentation, when you think they asked a
stupid question. Google counts nearly forty occurrences:

http://groups.google.com/groups/sea...as_usubject=&as_uauthors=Arne+Vajhøj&safe=off

For "try and", Google counts over 150, with the first hit being for
"try and read" specifically:

http://groups.google.com/groups/sea...as_usubject=&as_uauthors=Arne+Vajhøj&safe=off

Even though you frequently order other people to do a better job of
reading various things, your own reading comprehension (not to mention
spelling and grammar) sometimes leaves much to be desired. Two recent
examples:

http://groups.google.com/group/comp.lang.java.programmer/msg/ebb01e54b5feb177?dmode=source
http://groups.google.com/group/comp.lang.java.programmer/msg/c2dc94bebab85c0c?dmode=source

In the first, you seem to have confused non-static for static, and in
the second, when someone asked why some software didn't notify them of
updates, you responded that it would be a bad idea for it to update
itself, which says nothing about mere notification of the existence of
an update. There are numerous other examples.

This type of thing, combined with the frequent egregious spelling and
grammar errors and the flaming, makes you appear to be an illiterate
brute, yet clearly you are not; you are knowledgeable about computer
programming, which is about as far from illiterate as it is possible
to get and which requires patience and delicacy rather than
brutishness. You can't browbeat a compiler into accepting bad code, or
browbeat the runtime environment into doing what you want it to; you
must finesse it.

Yet these days you treat computers better than you treat people.
Having discovered that people do sometimes do as you wish when
browbeaten, you've unfortunately made it a common way of interacting
with other people, as demonstrated by these Google pages:

http://groups.google.com/group/comp.lang.java.programmer/msg/b3d4e7efaa2fd9cd?dmode=source
http://groups.google.com/group/comp...read/thread/d7d67d116bd9c2e8/4aed1ac6fcbb2874
http://groups.google.com/group/comp...read/thread/f13469c8a0beec89/69f0b091da259096
http://groups.google.com/group/comp...read/thread/f13469c8a0beec89/8e63b61cb085fd90
http://groups.google.com/group/comp...read/thread/d134f3b2fc7cb3a6/66a0cbc9aab98fe5
(continuing onto the next two pages of the same thread, for a grand
total of 24 posts in the space of just an hour and a half!)

Each of the above links shows a portion of a thread, with long runs of
many posts in a row by you flaming some target or another in each
case. You spare these targets no indignity and you bash them senseless
with sometimes upwards of a dozen short and nasty posts in a row, most
or all of which suggest that you find them mentally deficient and many
of which order them about, or bluntly refuse when they ask you to be
more polite, or similarly. These people are treated as if they were
wayward children and you were an abusive father. Needless to say, most
of them don't react well to this, and you sometimes get as good as you
gave. Particularly when you tangle with Twisted, which you have done
repeatedly even though you should know better than to feed the trolls
in any newsgroup.

The turning point was reached when the editor rwar to end all editor
rwars erupted in comp.lang.java.programmer after Twisted used the
nuclear option versus his growing chorus of detractors. Unwisely, you
waded into the fray almost immediately, and particularly stupidly, you
remained in it long after it should have been clear that Twisted was
as imperturbable and stubborn as a force of nature, unable to be
bargained with, negotiated with, or convinced of anything. Far from
tilting at windmills, trying to change his mind about anything is
clearly more like tilting at the very wind itself. You can make more
headway arguing with Mentifex.

Here is a flame by you early in that horrible excuse for a usenet
thread:

http://groups.google.com/group/comp.lang.java.programmer/msg/25b677f177d13ea2?dmode=source

Here you and several others gang up on Twisted and try to invade his
privacy, which of course does not end well:

http://groups.google.com/group/comp...read/thread/ce27f65ea7256d97/85c23687384e630a

More browbeating of Twisted later in the thread and long after its
pointlessness had become apparent to every sane person on the face of
the Earth:

http://groups.google.com/group/comp...read/thread/ce27f65ea7256d97/c2f43bdb1c30a2dd
http://groups.google.com/group/comp...read/thread/ce27f65ea7256d97/cf9308d12ff928a1

And there were several more voluminous bombing runs like that last,
all the way up until the thread finally petered out several whole
months after it had started. None accomplished any worthwhile goal
except to waste your time and further establish your reputation as a
nasty-tempered brute with a troll-feeding addiction.

The experience so traumatized you that you began jumping at shadows,
seeing Twisted hiding beneath every rock, lurking behind every wall,
armed and waiting beyond every door. Naturally, your response to
suspecting someone of being Twisted was not to dismiss your thoughts
as paranoia, nor to back away slowly, but instead to make wild
accusations and spray insults around like machinegun fire. The end
results have typically not been pretty, especially since you have
often combined this with browbeating, flaming, and attempts to invade
Twisted's privacy, which invariably results in Twisted himself
entering the fray, thereby ensuring the destruction of yet another
formerly-useful thread:

http://groups.google.com/group/comp...read/thread/47c0cc7cf3fe15cf/df3b046b65f2fc0f
http://groups.google.com/group/comp...read/thread/91ee4f8b397f916e/063e06d2027b076d

Both of these examples also contain your infamous rude and
ungrammatical catch-phrase, "try read". Considering how you often
sound only semi-literate yourself, and the numerous demonstrations of
your own failures at reading comprehension (noted above), your
insinuations that others have poor literacy and reading comprehension
seem rather hypocritical.

Amazingly, you did eventually manage to successfully coerce Twisted
into changing his mind about something, eventually. By constantly
flaming other people accusing them of being him, you seem to have
single-handedly caused him to eventually relent on his insistence on
anonymity and reveal his real name in recent months, apparently
because even Twisted is not 100% without compassion and didn't believe
that other people deserved to be flamed for Twisted's own misdeeds.
This feat, of actually getting Twisted to change his mind, is truly
astounding. It's a shame it was accomplished by such bloody and
brutish methods.

Of course, it didn't appease you and your rampage continued; you have
kept right on launching paranoid attacks on random bystanders,
including this example posted less than a week ago:

http://groups.google.com/group/comp.lang.java.programmer/msg/5510cb431852e058?dmode=source

This has already drawn Twisted into the thread to flame you and assert
his usual hostility towards "feedback loops", whatever those are.
Thus, a formerly-useful discussion of Java exception handling has now
been destroyed. Congratulations. Do you feel proud of this
accomplishment?

Others have called you on your paranoia (even discounting Twisted), to
no avail. Others have also implored you to stop feeding trolls,
including the very man that became the latest target of your paranoia,
but this advice you also have ignored. No matter how many times you
are told it's stupid behavior, anyone who disagrees with you you
insult, and anyone who flames back or otherwise refuses to bow to your
superior wisdom is flamed and frequently browbeaten and/or accused of
being Twisted.

And to top it all off, you have been known at times to express pro-
Microsoft sentiments:

http://groups.google.com/group/comp.lang.java.programmer/msg/09ba4c34201ccbab?dmode=source
(and several subsequent posts to the same thread)

This, combined with your heavy participation in
microsoft.public.dotnet.languages.csharp, won't make you any friends
among the open source movement.

But what really does you in is your abrupt and impatient attitude and
your tendency to not only participate in flamewars and feed trolls but
to actively encourage the destruction of once-useful threads and to
take actions that you know will attract the participation of trolls.
These traits, which have grown worse over the years, serve you ill and
make it less likely that you will make friends anywhere, even among
Microsoft apologists. And there is the recent addition to your
repertoire of paranoia, which damages your credibility and leads to
yet more flamewars.

Partly, your problems stem from an apparent inability to simply ignore
someone once you begin to suspect that maybe they are stupid or
ignorant. Rather, you feel an irresistible compulsion to point these
traits out in whomever you suspect possesses them. Moreover, you
frequently feel the need to drive your point home with a sledgehammer.
Coupled with a curious inability to work your newsreader's killfile
(doubly curious in light of your knowledge of multiple operating
systems and programming languages) and your growing paranoia about
Twisted, they doom you to inarticulate rage and a signal to noise
ratio that is abysmal: over 90% of your news posts in recent years are
worthless, and over 10% are to the Thread From Hell alone.

Over the sixteen years since your initial spate of helpful posts to
comp.os.vms, you have ceased to bless Usenet with your presence and
begun instead to curse it, and particularly the newsgroup
comp.lang.java.programmer, which bears the brunt of the consequences
of your paranoia and unwillingness to killfile trolls. Not only do you
directly contribute a not-insignificant number of off-topic posts,
flames, and general rudeness to that group these days, but by
frequently rolling out the red carpet for Twisted by gratuitously
insulting him or accusing others of being him, you indirectly
contribute at least 40% of the total amount of noise in that
newsgroup, if not more. In newsgroups not afflicted with Twisted, it
is closer to 10%, but that's still not insignificant.

It is not too late to change your ways. Yet your rude impatience may
yet earn you a place of honor in alt.flame; your troll-feeding
tendencies may yet qualify you as a troll in your own right; and your
paranoia may yet earn you the title of KotM in alt.usenet.kooks.

If you have an excuse for your behavior, please speak now, and give
your apology before the witnesses gathered here.

If you do not, then know that your soul is forever tainted!
 
J

Jie Wang [MSFT]

Hi Rainer,

I agree with Pete.

If you have no control over the "host" application, and that host
application itself is not aware of .NET, loading CLR and run managed code
could make things complex, and C# cannot export win32 functions anyway.

Best regards,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jerry Gerrone

And now I find myself spontaneously badmouthed on a microsoft.*
newsgroup.

On Feb 28, 9:30 am, Arne Vajhøj <[email protected]> wrote:
[snip]

Aha, the usual suspects.
[a reasonably polite on-topic post]

[flames Arne for several paragraphs with the usual kooky fervour]

Each of the above links shows a portion of a thread, with long runs of
many posts in a row by you flaming some target or another in each
case. You spare these targets no indignity and you bash them senseless
with sometimes upwards of a dozen short and nasty posts in a row, most
or all of which suggest that you find them mentally deficient and many
of which order them about, or bluntly refuse when they ask you to be
more polite, or similarly.

This much I can attest is actually true.
Needless to say, most of them don't react well to this, and you
sometimes get as good as you gave. Particularly when you tangle with
Twisted, which you have done repeatedly even though you should know
better

And if soul.mirror1 had left it at that, all would be well. But, alas,
he didn't:
than to feed the [insult deleted]

No, you're the troll.

None of the nasty things that you have said or implied about me are at
all true.
The turning point was reached when the editor rwar to end all editor
rwars erupted in comp.lang.java.programmer after Twisted used the
nuclear option

Oh, no, not this shit again.

Once more, for the record and with emphasis: it was an offhand remark.
Nobody could have foreseen the amazingly disproportionate nonlinear
effects without a time machine or a truckload of LSD. Give it a rest
already!
Unwisely, you waded into the fray almost immediately, and
particularly stupidly, you remained in it long after it should have
been clear that Twisted was [numerous implied insults deleted]

No, you're the crazy one.

None of the nasty things that you have said or implied about me are at
all true.
[compares me to Mentifex]

None of the nasty things that you have said or implied about me are at
all true.
Here you and several others gang up on Twisted and try to invade his
privacy, which of course does not end well

Of course.
More browbeating of Twisted later in the thread and long after
[subtle but serious implied insult deleted]

No, you're the crazy one.

None of the nasty things that you have said or implied about me are at
all true.
And there were several more voluminous bombing runs like that last

You have quite the fixation with explosives, doncha? Are you, by any
chance, male, age 14 to 19, by night a watcher of movies starring big
muscular men that speak little but blow up a great deal (and of course
scantily-clad women with improbably large breasts for their frames)
and by day someone who's primary skill exercised is saying "Would you
like fries with that?"

Inquiring minds want to know.
None accomplished any worthwhile goal except to waste your time and
further establish your reputation as a nasty-tempered brute with a
[implied insult deleted]

No, you're the troll.

None of the nasty things that you have said or implied about me are at
all true.
The experience so traumatized you that you began jumping at shadows,
seeing Twisted hiding beneath every rock, lurking behind every wall,
armed and waiting beyond every door.

And waiting to pounce on any attempt to badmouth him behind his back?
Well, that last, at least, is quite true.

Periodically googling my name and my past nicknames has turned up all
kinds of very interesting things, though none until now in a
microsoft.* newsgroup -- a dubious honor to be sure. :p
Naturally, your response to suspecting someone of being Twisted was
not to dismiss your thoughts as paranoia, nor to [implied insult
deleted]

No. None of the nasty things that you have said or implied about me
are at all true.
but instead to make wild accusations and spray insults around like
machinegun fire. The end results have typically not been pretty,
especially since you have often combined this with browbeating,
flaming, and attempts to invade Twisted's privacy, which invariably
results in Twisted himself entering the fray, thereby ensuring the
[false accusation deleted]

No, you're the one that destroys threads, hypocrite.

None of the nasty things that you have said or implied about me are at
all true.
[flames Arne some more, thankfully without mentioning me]

Amazingly, you did eventually manage to successfully coerce Twisted
into changing his mind about something, eventually.

He did nothing of the sort.
By constantly flaming other people accusing them of being him, you
seem to have single-handedly caused him to eventually relent on his
insistence on anonymity and reveal his real name in recent months

Actually, a number of factors led to that decision, including the
systematic flaming of a particular other person by multiple people
(including, but by no means limited to, Arne) which I could find no
other way to try to stop. The decision was, however, ultimately mine.
I was not by any stretch of the imagination successfully "coerced" to
do anything.
apparently because [implied insult deleted] Twisted is not 100%
without compassion

I'm certainly much more compassionate than you are. You on the other
hand are clearly an equal-opportunity flamer and a troll of the worst
sort, the variety that ascends a pulpit and purports to claim the
moral high ground whilst disrupting newsgroups left and right. As of
last count, you have serially disrupted at ten newsgroups, including
comp.lang.java.programmer, several other comp.lang.* newsgroups, and
rec.games.roguelike.angband. (I don't count alt.religion.scientology
since that newsgroup is continually self-disrupting, nor sci.math
where you posted into a thread whose only other participant was
Archimedes Plutonium nattering away to himself for 154 posts in a
thread nobody else was reading. Did you know that as of nearly two
weeks later he has posted several more replies to himself in that
thread, and none at all to you, or even in reference to you? I bet
that annoys you. If it does, it means you are a troll and resent him
for not obliging to feed you. As for why I arguably am, I need to
speak up here in my own defense anyway, so I might as well also point
out your numerous flaws while I'm at it. Particularly if it helps
discredit you and therefore discredit the nasty things that you've
said about me here and elsewhere.)
and didn't believe that other people deserved to be flamed for
Twisted's own misdeeds.

I have no misdeeds. Your statement therefore makes no sense, since it
has an empty set on the right hand side of the cause-of-flaming
expression. It won't compile, d00d!
[implied serious insult deleted]

None of the nasty things that you have said or implied about me are at
all true.
[some more flaming of Arne deleted]

This has already drawn Twisted into the thread to flame you and assert
his usual hostility towards "feedback loops", whatever those are.

I've explained numerous times what they are and why I find them
objectionable.
Thus, a formerly-useful discussion of Java exception handling has now
been destroyed. Congratulations. Do you feel proud of this
accomplishment?

Destroyed by Arne's paranoia, not by me. As near as I can tell by
reviewing the thread in question, a potentially-amicable dispute over
the exact magnitude of pain that would be caused by a potential syntax
change failed to actually be amicable in large part because Arne and
at least one other participant got surly and impatient with their
opponent. Said opponent, it should be noted, did not respond in kind
but called them on their hostile attitude and then quit in disgust. As
a parting shot, Arne let loose quite a volley of insults and yes,
paranoia. This, rather than anything I did, was what finished off an
already wounded thread. Several days BEFORE I posted my first post to
it, which of course I did purely in self-defense when spontaneously
badmouthed, much as I am doing here now, and which remained largely
civil.
Others have called you on your paranoia (even discounting Twisted)

Why should I be discounted? Because I am the target of said paranoia?
If anything, that should give my opinions extra weight. Although I
suppose one could make the usual arguments regarding "emotional
involvement" and similar psychobabble.
Others have also implored you to stop [implied insult deleted]

No, you're the troll.

None of the nasty things that you have said or implied about me are at
all true.
including the very man that became the latest target of your paranoia

That man appears to be predominantly a useful contributor to cljp --
when he isn't flaming me, that is. That rather unfortunate tendency of
his detracts from his credibility in my opinion, but does not suffice
to make him a troll! Nor does the same tendency, coupled by paranoia,
in Arne. Whatever else he might be, a troll he is not.
No matter how many times you are told it's stupid behavior, anyone who
disagrees with you you insult, and anyone who flames back or otherwise
refuses to bow to your superior wisdom is flamed and frequently
browbeaten and/or accused of being Twisted.

This behavior of his, though more-or-less accurately described, seems
somewhat intermittent and fitful.

I can't pretend to know what psychological problems underlie it,
though the paranoia renders "getting him to actually use his killfile"
insufficient to correct things.

On the other hand, "accused of being Twisted" implies that being
Twisted is something bad.

It is not.

None of the nasty things that you have said or implied about me are at
all true.
And to top it all off, you have been known at times to express pro-
Microsoft sentiments:

http://groups.google.com/group/comp.lang.java.programmer/msg/09ba4c34...
(and several subsequent posts to the same thread)

A misdemeanor, at the end of a long list of felonies? Seems
gratuitous. Then again, almost everything in almost all of your posts
seems gratuitous. Probably because you're a troll.
This, combined with your heavy participation in
microsoft.public.dotnet.languages.csharp, won't make you any friends
among the open source movement.

There's an open source implementation of dotnet and of csharp, last
time I checked. Microsoft may have intended it to be proprietary and
evil, but apparently did not succeed in this instance. :) (My God, am
I actually on topic?)
But what really does you in is your abrupt and impatient attitude and
your tendency to not only participate in flamewars and [implied insult
deleted] but to actively encourage the destruction of once-useful
threads and to take actions that you know will attract the
participation of [insult deleted].

No, you're the troll.

None of the nasty things that you have said or implied about me are at
all true.
Partly, your problems stem from an apparent inability to simply ignore
someone once you begin to suspect that maybe they are [implied insult
deleted].

No, you're the stupid one.

None of the nasty things that you have said or implied about me are at
all true.
[insults Arne for another long paragraph]

Over the sixteen years since your initial spate of helpful posts to
comp.os.vms, you have ceased to bless Usenet with your presence and
begun instead to curse it, and particularly the newsgroup
comp.lang.java.programmer, which bears the brunt of the consequences
of your paranoia and unwillingness to killfile [insult deleted].

No, you're the troll.

None of the nasty things that you have said or implied about me are at
all true.
Not only do you directly contribute a not-insignificant number of
off-topic posts, flames, and general rudeness to that group these
days, but [numerous nasty insults deleted]

No, you're the noisemaker and the one that "afflicts" newsgroups.

None of the nasty things that you have said or implied about me are at
all true.
It is not too late to change your ways. Yet your rude impatience may
yet earn you a place of honor in alt.flame; your [implied insult
deleted] tendencies may yet qualify you as a troll in your own
right;

No, you're the troll.

None of the nasty things that you have said or implied about me are at
all true.
and your paranoia may yet earn you the title of KotM in
alt.usenet.kooks.

Arne is unlikely to receive that particular "award". You, on the other
hand...
[standard boilerplate deleted]

Go jump off a bridge.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top