flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > HELP: linking asm and c++ Goto page 1, 2 Next |
Author |
|
LocoDelAssembly 27 Sep 2010, 18:00
Please don't post with option "Disable BBCode in this post" set (check your profile settings, it may be you have set it by default). With the option set, the code tags have no effect and your sources are shown as regular text (without indentation nor highlighting)
The problem is that you are trying to reference C++ externs that is why it is asking you so weirdly decorated names. Try using __cplusplus (notice the double underscore) instead, and if it continues then remove the conditional preprocessing (i.e. force the use of - extern "C" { - always) |
|||
27 Sep 2010, 18:00 |
|
tutenhamon 27 Sep 2010, 18:46
commenting preprocessor directives does not help ;(
if I don't use precompiled headers the problem does not occur (MSVC 2010 EE) but the program was crashes |
|||
27 Sep 2010, 18:46 |
|
bitshifter 28 Sep 2010, 07:27
I think you must define parameter length...
See vid's example: http://flatassembler.net/examples/msvc.zip |
|||
28 Sep 2010, 07:27 |
|
vid 28 Sep 2010, 17:34
biutshifter: Nay, that would be only if he used stdcall procedures. I think Loco is right, "_cpluscplus" ought to be "__cplusplus". But it is some time since I last interfaced Asm with C++
|
|||
28 Sep 2010, 17:34 |
|
iic2 28 Sep 2010, 17:58
Beware that _Avira flag the zip as a virus. Will they ever learn?
|
|||
28 Sep 2010, 17:58 |
|
ManOfSteel 28 Sep 2010, 19:22
iic2 wrote: Will they ever learn? They do. As soon as you hit the "Uninstall" button. |
|||
28 Sep 2010, 19:22 |
|
iic2 28 Sep 2010, 20:27
I'm crazy about Avira but when it come to even clean written programs in FASM or trying to do some fancy which only ASM that they don't have a clue about, they put you in a fancy class with some bad guy name and flags you as a virus to the world. Now you have to change the structure of your program to satisfy the Anti-Virus writers who use C++. We can't even explore writing manual-PE or come up with new invention with-out getting cursed out. Sometime it make you wonder what the use of programming in ASM for Windows. First you have to get pass Dollar Bill with something special, now you have to fight with somebody high-level program that want to call the shots on your FASM creation. Now we got two bosses, and growing. The only thing left is to kill the use of ASM programs in the next generations of Windows because someone said "bad-bad app bad bad". But my post was not intended to change the OP subject.
|
|||
28 Sep 2010, 20:27 |
|
bitRAKE 29 Sep 2010, 05:46
Stop using anti-virus software - it is useless.
|
|||
29 Sep 2010, 05:46 |
|
revolution 29 Sep 2010, 05:56
But we have to convince the masses of that. You can't just go releasing software and say to the users that they must remove their virus scanner(s) before they can use it.
|
|||
29 Sep 2010, 05:56 |
|
vid 29 Sep 2010, 09:46
... or start writing standard PEs
|
|||
29 Sep 2010, 09:46 |
|
revolution 29 Sep 2010, 10:00
vid wrote: ... or start writing standard PEs |
|||
29 Sep 2010, 10:00 |
|
baldr 29 Sep 2010, 18:11
revolution wrote: Since there is no such thing as a standard PE file. revolution wrote: Note that fasm does generate perfectly valid PE files. |
|||
29 Sep 2010, 18:11 |
|
vid 29 Sep 2010, 19:12
revolution: OK, "de-facto standard PE", and there is such thing (otherwise AVs couldn't use this heuristics).
baldr wrote: With regard to you previous statement this seems contradictory: "valid according to what? Not regularly updated specification is still a specification. |
|||
29 Sep 2010, 19:12 |
|
revolution 29 Sep 2010, 21:42
baldr: Think of it like this:
Spec for a car: -Must have four wheels -Must have doors for people to enter/exit -Must have an engine A "standard" (i.e. car produced by most popular manufacturers) car: -Wheels are 22 inch -Four doors, two in each side with hinges towards the front -4 cylinder, two values per cylinder A "valid" car, not "standard", but fits the spec: -Wheels are 27 inch -Two gull wing doors -8 cylinder, 4 valves per cylinder Note: I just made up the figures above. But I hope it shows the point here: that PE files can still conform to a spec and still differ markedly from the usual PE file. |
|||
29 Sep 2010, 21:42 |
|
tutenhamon 29 Sep 2010, 21:48
help, help, help
|
|||
29 Sep 2010, 21:48 |
|
LocoDelAssembly 29 Sep 2010, 22:11
tutenhamon, I've just tried and worked properly, are you really doing what I've told you?
Anyway, my sources: TestPad.cpp Code: // TestPad.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "tutenhamon.h" int _tmain(int argc, _TCHAR* argv[]) { char buff[256]; for (int i = 0; i < 256; buff[i++] = '\0'); /* The assembly routines are not really ensuring NUL termination */ getVendorString(buff); printf("%s", buff); getchar(); return 0; } Then I've compiled your fasm source and used the "Add > Existing Item..." feature to add the object file. All this was a fresh and with all defaults Win32 console application project created with Visual Studio 2010 Professional. Output of the program: Code: AuthenticAMD |
|||
29 Sep 2010, 22:11 |
|
baldr 30 Sep 2010, 00:31
revolution,
Let's define valid PE as a binary that can be run under whole line of 32-bit Microsoft OS. Is it OK? |
|||
30 Sep 2010, 00:31 |
|
revolution 30 Sep 2010, 00:49
baldr wrote: Let's define valid PE as a binary that can be run under whole line of 32-bit Microsoft OS. Is it OK? 1) The PE spec (that defines a valid PE file) is very broad. 2) The Win32 loader can only load a small portion of all possible valid PE files. 3) The AVs only let pass and even smaller range of PE files than even the Win32 loader will support. Hence the problem. When writing code in assembly, and wanting to avoid unnecessary AV warnings, then you have to restrict the way in which you create the PE file. |
|||
30 Sep 2010, 00:49 |
|
bitRAKE 30 Sep 2010, 01:41
revolution wrote: But we have to convince the masses of that. You can't just go releasing software and say to the users that they must remove their virus scanner(s) before they can use it. _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
30 Sep 2010, 01:41 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.