I've coded a dll in masm, it works when I use it with another program coded in masm or delphi but when I try to use it with VB I get the error:
Run-time error '453':
Can't find DLL entry point MyFunction in MyDll.dll

this is what I use when compiling the dll:
ml /c /coff /Cp c:\masm32\MyDll.asm
link /DLL /subsystem:windows /EXPORT:MyFunction /LIBPATH:c:\masm32\lib MyDll.obj

I have searched for a solution on this but havn't found anything that have solved the problem.
Posted on 2005-03-04 16:10:13 by Azura
Do you use in VB a declaration that looks like the following?

Declare Sub MyFunction () Lib "MyDll.dll" Alias "MyFunction"

or

Declare Sub MyFunction () Lib "MyDll.dll" Alias "_MyFunction@0"

If you have dumpbin, use it to find out what alias the DLL is exporting...

dumpbin /exports mydll.dll
Posted on 2005-03-05 01:43:44 by tenkey
This is how I declare it in VB, the second parameter should be a pointer to a byte array, don't know how to declare that.
Declare Sub MyFunction Lib "MyDll.dll" (ProcessID As Long, ByRef Info() As Byte, InfoLength As Long)

How and when should I use ByVal and ByRef when declaring it?

I used dumpbin: dumpbin /exports MyDll.dll
And got this:


File Type: DLL

Section contains the following exports for MyDll.dll

0 characteristics
42289478 time date stamp Fri Mar 04 18:01:44 2005
0.00 version
1 ordinal base
1 number of functions
1 number of names

ordinal hint RVA name

1 0 00001023 MyFunction

Summary

1000 .data
1000 .rdata
1000 .reloc
1000 .text
Posted on 2005-03-05 06:45:13 by Azura