PDA

View Full Version : VB Net DLL Problem



Buffman
10-03-2006, 11:10 AM
Hi Everyone,

I'm having a problem with a simple DLL I wrote, and I'm hoping someone could point me in the right direction...

When I call the DLL from AMS, I receive a 2401 error - "Failed to find the specified function within the DLL."

sReturn = DLL.CallFunction("Autoplay\\Docs\\Test.dll", "Number", "", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);

In troubleshooting, I've made the logic as simple as possible, but still receive the error. I'm thinking its because VB .Net requires functions to be inside a class and AMS can't see that. Any thoughts?

DLL Source:

Public Class Class1
Public Function Number() As Integer
Dim i As Integer
i = 9
Return i
End Function
End Class

Worm
10-03-2006, 11:58 AM
I'm not up on .Net stuff at all. I can say that the languages I've used to make DLLs required me to use an EXPORT AS or ProcedureDLL for my functions. Maybe that'll give you something to Google on.

Buffman
10-03-2006, 12:32 PM
Thanks Worm, I'll look into it and report back!

lnd
10-03-2006, 02:03 PM
the vb files and the ams6 files
in the text i dont see a problem.
you check in vb6 or only in .net?

Brett
10-03-2006, 04:01 PM
I am not sure about how .NET DLLs export their functions, but I would be pretty surprised if they work. I think that .NET DLLs may export a Typelib file which means it may be COM callable. You could look at using LuaCOM with it.

The other problem with VB.NET DLLs is that they require the .NET runtime to be installed in order to work.

Personally, I would consider using a C/C++ DLL if possible.

Buffman
10-03-2006, 05:13 PM
Thanks guys,

Yeah VB .NET creates COM or ActiveX dlls, not standard dlls. I'm looking to see if there's a way to export functions, but it doesn't look like it'll be AMS compatible.

Looks like its time to start learning some C/C++...

Thanks!

Intrigued
10-03-2006, 05:32 PM
Thanks for the headsup with .NET and its version of DLLs.

(yucky!)

Brett
10-04-2006, 09:03 AM
Or, if you prefer the Basic language, look at PowerBasic and RealBasic. I think some of the folks on the forums here have used them to make native DLLs that are callable from AMS.

Worm
10-04-2006, 09:27 AM
I've used PowerBasic and PureBasic to create the DLLs I've posted. PowerBasic is nice, but its pricey. I'd suggest PureBasic. The cost is relatively low, and the freatures are many.

I have RealBasic too, but it won't compile to a DLL.