Thanks for the REALLY good info. This is the best so far.

To explain why I am passing a 16bit to a 32bit.....I am a newbie!! This was a 16bit DLL and I was trying to make it a 32bit, but from these few comments, there must be an error in code.

This is my FIRST ASM project. I have really no resrouces but the internet and noone here at my office has much knowledge either.

I am in a sinking boat and I am the only one with a bucket! :)

Thanks so much for the help re-creating the DLL... I guess I will try to figure out what the P2L32 macro is doing wrong....

here is the original code for that macro before I tried to convert it:

P2L32 Macro local32,passedptr
push ds
LDS si,passedptr
pop ds
MOV local32,AX
MOV local32+2,CX

I was trying to convert from a sample that was given to me for one of the others, but I must have made some mistake.

Thanks so much for your help. I hope to do this myself, I have learned so much already.

Posted on 2001-10-25 07:35:19 by mikef
Also, I did use a .DEF file... it's contents were this:

LIBRARY trackwx.dll
EXPORTS trinfo

Maybe this file is not setup correctly????
Posted on 2001-10-25 07:45:34 by mikef
I tried track3.dll, but could not get VB to see the file. I kept getting file not found.

I went back to the previous DLL and found that I can make my call with the following Declare:

Private Declare Sub trchk Lib "c:\windows\desktop\tracker\trackwx.dll" (baseaddr%, retcode%)

But is is returning the negative numbers due to my error, which I can't figrue out either.

Why am I not able to use the track3.dll???

This is VERY hard stuff.... I knew it would be difficult, but WOW... what a shock.

Thanks again and again. :)
Posted on 2001-10-25 07:58:15 by mikef

lets do one step after the other

1. why cant I use track3.dll?
- rename your functioning c:\windows\desktop\tracker\trackwx.dll to c:\windows\desktop\tracker\$trackwx.dll and look if then VB doesn't find your dll (it shouldn't)
- now copy track3.dll to the location of trackwx.dll and rename it to trackwx.dll
- start your app again. VB should now find this dll

2. DEF file
best is not to use a DEF file because you may not get the correct "decorations". The correct decorations are (use Quickview):

1 0 00001032 _trchk@8
2 1 0000109A _trclrpos@4
3 2 00001345 _trhld@4
4 3 00001000 _trinfo@4
5 4 0000121A _trreadall@16
6 5 0000117F _trreadpos@8
7 6 00001019 _trsetadr@4
8 7 000010FF _trsetpos@8
9 8 00001370 _trsts@4
10 9 000013A0 _trsync@8

As you can see, each function gets a "_" prefix" and a "@n" suffix. This is good
:) .

Now check your VB source code to find a call to any kernel, user or gdi function. These functions are decorated like these in track3.dll. Check that your declarations in VB look similar.

Posted on 2001-10-25 08:34:46 by japheth
3. your macro P2L32 actually looks like:

P2L32 Macro local32,passedptr
mov eax, passedptr
pop [eax]
push local32

and your 16 bit version looks like:

P2L32 Macro local32,passedptr
push ds
LDS si,passedptr
pop ds
MOV local32,AX
MOV local32+2,CX

Your 32 bit version is wrong. It should look like:

P2L32 Macro local32,passedptr
mov eax,passedptr
mov eax,[eax]
mov local32,eax

Posted on 2001-10-25 08:42:09 by japheth
Thanks for the tip.

I tried what you said exactly, but still get File Not Found when using track3.dll.

I will post my VB code to a ZIP on this message. There may be an error there, if anyone cares to look.

Thank you so much for your expertise.

Posted on 2001-10-25 08:43:25 by mikef
mikef, sorry I missed a linker option:


link track3.obj /subsystem:windows /dll /out:track3.dll

instead of:

link track3.obj /subsystem:windows /out:track3.dll

to link the dll.

may be this helps.

Posted on 2001-10-25 09:01:10 by japheth
heres the newly created dll
Posted on 2001-10-25 09:11:23 by japheth

I tried it and now I don't get the File Not Found error, but I am getting this error now:

Can't find DLLEntry point trinfo in c:\windows\desktop\tracker\work3\track3.dll

here is my declare:

Private Declare Function trinfo Lib "c:\windows\desktop\tracker\work3\track3.dll" (rev&)

Thanks again.
Posted on 2001-10-25 09:11:58 by mikef
obviously VB has some problems with name decoration. Try using the alias directive:
Private Declare Function trinfo Lib "c:\windows\desktop\tracker\work3\track3.dll" alias "_trinfo@4" (rev&)

if this works, you better use your .DEF file in the link step (I have to apologize to sluggy then)

link track3.obj /subsystem:windows /dll /def:track3.def /out:track3.dll

Posted on 2001-10-25 09:55:52 by japheth
Do I need to re-compile with the DEF file before I use the new Declare?

I used this Dclare:

Private Declare Function trinfo Lib "c:\windows\desktop\tracker\work3\track3.dll" Alias "_trinfo@4" (rev&)

Without re-compliling and now I get Bad DLL Calling Convention.

Thanks again!!

Posted on 2001-10-25 10:22:01 by mikef

you get now another error. So please use your def file and relink your dll. After relinking restore your declare in VB (no alias required).

You will probably still get your "BAD call conv" error. To avoid these errors change your declarations from "Declare Function tr... (xxx,...)" to "Declare Function tr... (xxx,...) as integer".

And there is another error in your macros. change L2P16 to
L2P16 Macro passedptr,local16
mov AX,local16
mov ecx, passedptr
mov ,AX

I have uploaded a new attachment

Posted on 2001-10-25 10:27:00 by japheth