Page 1 of 1

calling a dll created in vb.net 2010

Posted: Fri Dec 16, 2011 2:59 am
by epidemicz
Have been searching and searching with no luck, so it's time so finally post.. Can anyone tell me how to call a vb.net dll in pure basic?

I made a vb.net dll in visual studio 2010 (file->new->project->class library)

It looks like this basically

Code: Select all

Public Class MyClass
    Public Function test()
        Return 12
    End Function
End Class
And in pure basic, I can open the library fine... However, I cannot examine the functions.

Code: Select all

If OpenLibrary(0, "MyDll.dll")
  Debug "Opened Library..."
  returnValue = CallFunction(0, "test")
  Debug "returnValue: " + Str(returnValue)
  CloseLibrary(0)
EndIf
So that returnValue is 0 and I also get 0 when using ExamineLibraryFunctions. Seems like this should be simple, but I'm agitated beyond belief at the moment. Would really appreciate any help! Thanks for your time.

Re: calling a dll created in vb.net 2010

Posted: Fri Dec 16, 2011 6:09 am
by IdeasVacuum
..... I'm often wrong but does that imply dependency on the .Net runtime?

Re: calling a dll created in vb.net 2010

Posted: Fri Dec 16, 2011 6:29 am
by epidemicz
IdeasVacuum wrote:..... I'm often wrong but does that imply dependency on the .Net runtime?
Yeah, I'm sure it would. Crazy, but that's not a big deal for me.

Re: calling a dll created in vb.net 2010

Posted: Fri Dec 16, 2011 7:46 am
by Shield
You can't do that that easily. There might be a way using COM but you probably have to
consider if it's worth just to write the app in .NET completely. :wink:

Re: calling a dll created in vb.net 2010

Posted: Fri Dec 16, 2011 11:20 am
by Project Mayu
If someone can help port this Power Basic code to Pure Basic, then you can call a Dot Net DLL
http://powerbasic.projectmayu.dyndns.org/

Re: calling a dll created in vb.net 2010

Posted: Mon Dec 19, 2011 4:41 pm
by Rings
Project Mayu wrote:If someone can help port this Power Basic code to Pure Basic, then you can call a Dot Net DLL
http://powerbasic.projectmayu.dyndns.org/
similar:
http://www.purebasic.fr/english/viewtop ... 12&t=40058

Re: calling a dll created in vb.net 2010

Posted: Mon Dec 26, 2011 3:41 am
by Project Mayu
Similar, but a pain in the x to use, you have to register a COM object in order to use it. If not registered, then program will crash.

And that is why I came up with the proper way to do it, if it's there then use it, If not program can still continue.
If you have Powerbasic, then you could make a dll to do it, else translate the code to Purebasic.

I did start translating my code a while back, but stopped due to lack of time, and lack of Purebasic knowledge.
I still want to do it though, so I can run in x64 CPU's.