Btw, "default" might be wrong, it probably depends on your .model - STDCALL or C is probably what adds the default underscore prefix thingy. If you don't want the underscore, you can use one of the following ways to declare the EXTRN reference:

nanadingamlegnu PROTO SYSCALL
... or ...
EXTRN SYSCALL nanadingamlegnu:DWORD
Posted on 2004-02-21 19:07:58 by f0dder
why you argue?
speed is definitely not factor for such a tool, and size is not at least for me :)

i don't want argument why to program in assembly, but speed is for critical parts of code, like in graphics routines or some complex calculation
who cares about how fast your programs call WriteFile API
Posted on 2004-02-21 19:11:53 by comrade
Thank you Hutch,

there is an old thread with enough info too...



"why you argue?"
I don't you argue

Posted on 2004-02-21 22:03:30 by lingo12

Sorry to be a pain but the link was on another subject and I tried f0dders suggestion but it did not work.

I need to know what the third parameter is and how you call the data.


I tried declaring the data as,


and I now get a link error instead.

Posted on 2004-02-22 02:16:55 by hutch--

bin2obj /fi:data.bin /fo:data.obj /id:myidentifier
EXTRN SYSCALL myidentifier:byte
link main.obj data.obj


bin2obj /fi:data.bin /fo:data.obj /id:_myidentifier
EXTRN myidentifier:byte
link main.obj data.obj

If that doesn't work, you have some pretty weird setup or aren't using your tools correctly. It's not like any of this is rocket science.
Posted on 2004-02-22 09:29:36 by f0dder

"I need to know what the third parameter is and how you call the data.
/id:????? "

/id: _mytest is an identifier we give on the commandline,
used to access the data from our program.
Example: I'll use Vortex's example -> dialog.exe

1. We have a rsrc.rc file with one dialog
with 2 buttons and one menu

2. We create rsrc.res
Rc.exe rsrc.rc

3.From rsrc.res
we create two output
binary files Dlgbox.bin
and Menu.bin
We'll access them later with the Identifer names DlgTemp and MenuTemp
from Dialog.asm:

.model flat,stdcall
option casemap:none

[B]extern DlgTemp:byte[/B] ; without underscore
[B]extern MenuTemp:byte[/B] ; without underscore

include \masm32\include\
include \masm32\include\
include \masm32\include\
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib


msg db 'Dialog box with menu',0

4. We'll start Build.bat to build Dialog.exe :
\masm32\bin\ml /c /coff Dialog.asm
bin2obj /fi: Dlgbox.bin /fo: Dlgbox.obj /id: _DlgTemp
bin2obj /fi: Menu.bin /fo: Menu.obj /id: _MenuTemp
\masm32\bin\link /SUBSYSTEM:WINDOWS /STUB:Stub.exe
/MERGE:.rdata=.text /
/IGNORE:4078 Dialog.obj Dlgbox.obj Menu.obj

Note: _DlgTemp and _MenuTemp are with underscore

5.We have the resources from 1.
but without rsrc section in the Dialog.exe file

Posted on 2004-02-22 12:19:50 by lingo12
Heh, if my explanation wasn't easy to follow, the state of "top-league" assembly programmers is rather sad :tongue:
Posted on 2004-02-22 12:28:37 by f0dder

Thanks, I will have a play with the example.


Heh, if my explanation wasn't easy to follow, the state of "top-league" assembly programmers is rather sad

Seems the state of "top league" advice coming from modest genius's was off the pace as usual.
Posted on 2004-02-22 20:00:43 by hutch--
Jerry! Jerry! Jerry!
Posted on 2004-02-22 20:32:10 by comrade
*hands some popcorn and a cup of soda to comrade*

Hutch, I find it funny that you don't even know how to use your own "tools of the trade". Of course the advice I gave works, I tested it myself. Obviously if you used "nanadingamlegnu" in the assembly source and another identifier with bin2obj, it won't work - but then you're a retard.

If you care to look at the attached zip, you should see that, naturally, all the forms suggested by me will work.
Posted on 2004-02-22 21:26:04 by f0dder

The expression in English is "I was taking to the butcher, not the block". In this context when I want advice from an experienced assembler programmer like Lingo on one of his tools, I ask him, not someone limping around using a C++ compiler as a crutch.

Posted on 2004-02-23 05:47:31 by hutch--
I don't use crutches, I use tools - and I know how to use my tools. This includes masm. I guess you weren't able to follow the complete (asm, yes) example either, but that's probably too much to expect anyway :rolleyes:

btw, PUBLIC is for making stuff in your compilation module available to other modules, not for 'importing' externs. How well do you know your tools? And how is your grasp of the link process?
Posted on 2004-02-23 08:40:06 by f0dder

Much the same reply, your crutch is your problem, when I need info from an assembler programmer I ask one, not someone using their C++ compiler as a crutch.

Posted on 2004-02-23 09:04:40 by hutch--
What exactly are you trying to say?

I showed you how to make the stuff work, in assembly. And even MASM, your tool of choice, at that. My suggestion works, and I even explained what the issues are. I don't really see any 'crutches' here...

Btw, I would be happy if you would care to remove the few pieces I contributed to MASM32... I don't want to be associated with your lameness.
Posted on 2004-02-23 09:08:16 by f0dder
Here is your assembler lesson for the week.

; ?????????????????????????????????????????????????????????????????????????

.486 ; force 32 bit code
.model flat, stdcall ; memory model & calling convention
option casemap :none ; case sensitive

PUBLIC item1
PUBLIC item2

item1 dd 0
item2 db "Learn how to write assembler",0

; ?????????????????????????????????????????????????????????????????????????


Make a library out of it.

Make the following declarations in the calling code.


Use the data like this,

fn MessageBox,hWnd,OFFSET item2,"Hi",MB_OK or MB_ICONINFORMATION

When you sink this AMAZINGLY complex technical data, go blow your nose, its running again.

Posted on 2004-02-23 09:18:52 by hutch--
And just does that contradict with anything I've said? You use PUBLIC to export the symbols from the module where they're contained, and you use EXTERNDEF to import them in another module. Big deal.

Now compare this to:

I have tried declaring "mytest" as PUBLIC but when I try to load the address with code like,

mov eax, offset mytest

I get errors like,

: error A2006: undefined symbol : mytest

--- this sounds a lot like somebody trying import by using PUBLIC :rolleyes:

You might want to have a look at the friendly manuals or something :tongue:
Posted on 2004-02-23 09:23:38 by f0dder
Noting that I have already shown my disinterest in both your approach and what you have to say on technical matters, I am yet to see your point.

After having failed in the last effort, you have continued this vendetta by abusing Harold's hospitality again with the usual indifference to members in the forum.

I have already told you that as long as your arsehole points to the ground, you will never win an argument with me as you start from the wrong premise.

While there are some very good assembler language programmers in this forum, differing from your highly self acclaimed view of your own status, you are not one of them.

If I wanted high level advice on C or C++ programming, again I would be asking someone who actually does have the experience and this rules you out.

Continuing the stupidity of IRC style script kiddies in this forum is a mistake even by your standards and trying to enforce a pecking order of who can post what in the forum indicates an attempt to control the forum when you don't have the support to do so.

Sooner or later it will connect to you that your conduct in abusing Harold's hospitality again is an insult to the amount of work that he has done to keep this community going.

Posted on 2004-02-23 18:28:33 by hutch--
Let's see...

I offered an explanation of the whole name decoration thingamajig, rather than just "add an underscore". A rather brief description, but I assumed it would be enough for a person with at least a little assembly and tool knowledge. I didn't want to insult anybodys intelligence by cutting it out in cardboard, but perhaps I should have.

Now, Hutchesson...
If the real problem is that you won't take any advice, suggestions or corrections by me, I suggest that you ask people for help in PM's, rather than on a public forum, where everybody are free to answer questions.

Perhaps I shouldn't have poked fun at you for not understanding (or even trying?) my suggestion, but I couldn't really help it. I'm not a liar, so I'm not going to say I'm sorry - because I'm not.

Furthermore, I find it rather funny that you resort to comments like "someone limping around using a C++ compiler as a crutch", as I didn't mention C/C++ and gave advice in assembly. Dunno if you looked at the zip, but it has a masm .asm file + batch file for compilation - the only 'tricky' thing about it being that it requires that you have set up INCLUDE and LIB environment variables, as I dislike (semi-) absolute paths.

As for stating that I'm not an assembly programmer ("when I need info from an assembler programmer I ask one"), well, that is semi-correct. I'm a programmer, with heavy basis on C/C++, but I know my assembly well enough. I'm not claiming I can compete with bitRAKE or lingo or The Svin in terms of optimizing, and nor do I care to. I can get stuff running at the performance I need, and I obviously got both lingo's bin2obj and my own (which you didn't understand, either) running without problems. Plus, I know why your link failed, and I explained why. I don't think I have particularly high views of myself either, as I tend to admit when I'm wrong and people have better solutions than myself. I'm opinioated, sure, but I'm not beyond reach.

I wonder what you have to base "If I wanted high level advice on C or C++ programming, again I would be asking someone who actually does have the experience and this rules you out." on - since you haven't seen much of my work nor source, I would classify this as slander. I've only judged you from what you have displayed publicly.

I also think it's fairly clear that I actually care to help people around here, whether they use masm, fasm, HLA or C/C++ ... and that I know my tools of the trade fairly well (or at least how to find info in The Friendly Manual). (oh yeah, but of course I only do this to appear as a nice person, it's not like I actually care about people :rolleyes: )

If I was to flame in the same patronizing and nonsensical tone as you, I might try something like "What about losing your crutches? *cough* powerbasic *cough*". But that would be nonsensical, right? Because you obviously know your tools, your assembly, and your algorithms... right?

"trying to enforce a pecking order of who can post what in the forum indicates an attempt to control the forum when you don't have the support to do so." - who exactly is trying to do this? I'm not the guy who patronizes, and I take advice from whoever offers it. Even you, though I don't think I've seen anything usable from you for a while.

To everybody else, sorry (I actually am), hope you enjoyed the show and your popcorn. I must admit I find some twisted amusement in Hutchesson's sillyness and patronization. I'm sorry this has ruined yet a thread, and next time I'll try not throwing the first rock. But there will be a next time as long as hutch is acting silly and doesn't do some attitude adjustment. I believe there's an "ignore" feature on this board you can use on me if you think it's too much, and you are of course free to PM me if you want.

This will be my last "war-related" post in this thread, no matter what nonsense hutch might come up with. Moderators, feel free to cut out the "war" and put in under crusades or whatever - I politely ask you not to delete it, though, as I think it shows a thing or two about various persons, and I certainly stand up for each and every sentence I've uttered in this thread. Sorry for the mudthrowing, but I don't accept slander that isn't backed up by one single piece of factual information. I don't know if this thread can be 'rescued', and again - I'm sorry.
Posted on 2004-02-23 19:34:37 by f0dder

I can live with common sense in a world of peace but I can also live in a world of war, irritations, abuse and arguments. Through the waffle of your last post I find in bits and pieces a thread of common sense that had some promise.

If you don't start it, I won't respond to it, its as simple as that. When I asked Lingo about how to use his tool, it was his expertise I was looking for, not a smartarse wisecrack fom someone who was not the target of the question.

Leave this nonsense be and the world will roll along in peace, take it up again and it won't, simple enough.

Posted on 2004-02-23 23:33:58 by hutch--