Hi all. I'm new here, so I will need an answer in easy word. I'm trying to use some functions from a dll. I is part of another thread (not my program, another that's just running). It should perform IPC. To "talk" with it, I am trying to use a lib, compiled in C (not by me), with the necessary code. The lib has 5 functions, one of which is "FSUIPC_Open". I used includelib to include it, and my program assembles fine. When I try to link it, I get this error: ERROR LNK2001: unresolved external symbol _FSUIPC_Open@8 Where did I go wrong? Many thanx to all. Kefren
I may have partially solved. May this be due to the fact that the calling convention used in the lib is not stdcall, but c convention? If yes, how can I solve? should I use C calling convention in the asm file too? How? I know this are a lot of questions... Thanx, Andrea
As the docs say (masm32.hlp):
label PROTO [, :tag]...label - The name of the proc distance - Not needed in 32bit (all near) langtype - This will provide the necessary decoration to the function parameter - Parameter name tag - Parameter type Mirno
First off, I have no references to 'FSUIPC_Open' so I can just discuss your problem in general. It's a linker issue. If it assembles, you have a proper prototype. Well, it may be IMPROPER, but at least the proto matches how you use it. If it didn't match (or exist), the build step would fail. C uses the STDCALL convention, which is typical in asm work, ie, it's how all of Izc's tuts start, it's what that '.model flat,stdcall' line at the top means. A Link error such as this means the linker program (which used the object files output produced from ml.exe) cannot find some item your porgram needs. So... you apparently need a library for this dll you are trying to use. If you have a lib for it, great, just includelib it into your .asm. If you don't, you have to make one. Icz has a tut on his site how to do either a real lib or to just 'fake it' enough to work. ----------------------------- "I'm normally not a praying man, but if you're up there, please save me Superman!"
If you are using the default VC++ configuration, the C functions will be compiled with the CDECL calling convention. If you have the C source, you can use a prototype of the form: extern "C" __stdcall ftype FunctionName(arglist); If not, you will need to alter the MASM code to call those library functions with CDECL convention (instead of STDCALL).
First, thanx all. Second, I partially solved. I tried Mirno's suggestion, and declared C in the PROTO of those functions. Now it asks for 2 libs, uuid.lib and oldnames.lib. I though they were from C, so looked in the MS Platform SDK and in the DDK, and found them. But the linker says that oldnames.lib is wrong format and will be ignored. Then it goes on and I get my .exe. Does it mean that part of the code is ignored too? Will the .exe be fully usable? Thanx all again,Asm is great once you know it (I still don't!) Kefren