i created a .lib file with MASM32. i wonder how to reference it in C code?
Posted on 2003-11-30 23:15:21 by optimus
You should prototype the functions like these:

extern "C" void __stdcall printline(void);
extern "C" int __stdcall myfunction(int first,int second);

And pass the .LIB file in the arguments to the Linker.

Regards,
Mariano.

:alright:
Posted on 2003-12-01 03:33:18 by Eternal Idol Birmingham
I use LCC-Win32 and RadASM, can u give me an example with them?
Posted on 2003-12-01 06:44:01 by optimus
Really, not.

I don't have any of those apps but I'll try to help you anyway ...

THIS IS EXAMPLE CODE it's written for MASM32 and VC++.

argc PROTO

argc PROC uses ebx
invoke GetCommandLine
mov ebx,eax
xor eax,eax
until:
.if byte ptr != 0
.if byte ptr == 32
inc eax
.endif
inc ebx
jmp until
.endif
ret
argc ENDP

First you compile it (ml /c /Cp /coff in MASM32) and then you link it (Lib with MASM32).
After that you have a .LIB file.

The you must prototype the funcion in C++, the parameter passing convention it's stdcall.
The argc function doesn't have any parameter, then this should be the prototype:
extern "C" int __stdcall argc(void);

Then you must compile the C++ source file (cl -c in VC++) and link it with the assembler library (link any.cpp any.lib)

I hope you can figure out from that.

Regards,
Mariano.

In VC++
:alright:
Posted on 2003-12-01 06:54:45 by Eternal Idol Birmingham
in LCC:

Project->Configuration
There, on the "Linker" tab, under the label "Additional libraries", add the name of your lib.
Posted on 2003-12-01 12:42:29 by Ultrano
LCC-WIN32 does not use COFF libraries. You will need to convert them. See the LCC-WIN32 documentation.

Greg
Posted on 2003-12-01 13:31:31 by bushpilot
Thanks guys!! I'll try.
Posted on 2003-12-02 01:36:57 by optimus