Hello,

I have compiled and generated a lib with the following command

ml.exe /Cx /Cp /coff /c test.asm
lib.exe test.obj

it worked fine, except that when i change from .model flat, stdcall to .model flat, c
and let visual c++ 6 try to link, it gives the following errors:

test.lib(test.obj) : error LNK2001: unresolved external symbol _CloseHandle
test.lib(test.obj) : error LNK2001: unresolved external symbol _CreateFileA
test.lib(test.obj) : error LNK2001: unresolved external symbol _CreateFileMappingA
test.lib(test.obj) : error LNK2001: unresolved external symbol _DeleteFileA
test.lib(test.obj) : error LNK2001: unresolved external symbol _ExitProcess
test.lib(test.obj) : error LNK2001: unresolved external symbol _GetFileSize


these are all APIs i use inside the .asm file, why does changing from stdcall to c gives this problem ?

thanks in advance
rychar
Posted on 2008-09-11 14:39:30 by rychar
Fisrt: you mean MASM, not MASM32 - MASM is the assembler, MASM32 is hutch's package.

Next, the MASM32 include files are sorta crappy (for lots of reasons). But the relevant for you is that they depend on you setting ".model flat, stdcall" as default, since they don't specify individual calling convention for each API call. So you need that default, and will have to tag each of your own function prototypes with "C" calling convention.
Posted on 2008-09-11 15:46:33 by f0dder
You might wanna check out ObjAsm32 - its an oop programming environment that is built on top of MASM via an extensive set of macros which execute at Build time..
ObjAsm32 is a BUILDTIME environment - it interprets highlevel sourcecode (including class objects with single inheritance and polymorphism) and emits lowlevel asm to MASM.. it allows you to write code that looks similar to C++, and was designed with COM/C++/VB/MASM interfacing as one of the major objectives - and because its really being built by MASM, you can use asm any time you like, mixing asm with HLL as you see fit.
It's not C++, but its damn close (yes, its 100% interoperable), the main difference being that you are unhampered by the specifications of the COM model, and can break from convention when you wish to.
If you're interested, download the ObjAsm32 package from http://objasm32.tripod.com , read the installation notes, and address any further questions to myself or to Biterider.
Posted on 2008-09-12 01:42:44 by Homer
Thanks f0dder, Homer

From what I've seen, this is a problem with MASM32 include/libraries, and i have to solve it somehow, well, I gave ObjAsm32 a try, but from what I've seen, it still uses MASM32 libraries so it gives the same problem, still i liked ObjAsm,
Posted on 2008-09-12 14:07:00 by rychar
It's a problem with the MASM32 include files, and hutch isn't going to fix it. So you need ".model flat, stdcall".
Posted on 2008-09-12 17:50:32 by f0dder