Using C# DLLs in NeoBook

Questions or information that don't quite fit anywhere else

Moderator: Neosoft Support

Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: Using C# DLLs in NeoBook

Post by Neosoft Support »

I'm just making neobook react to some event by playing GoSub "Subroutine", nothing unusual. And event may occur whenever it (user) wants.
Both DBPro and FM/FTP include several actions that execute NeoBook subroutines just like that so it should work for you.

For the debugger error, try looking at the debugger screen while your plug-in is running and see if the executed actions are being nested (indented to the right). For example:

Action 1
Action 2
Action 3
Action 4

This indicates that the actions are being called from inside the preceding action. Some of that is acceptable, but if it goes on indefinitely you will run out of resources. Meaning something may be keeping your subroutines from terminating properly.
NeoSoft Support
Tony Kroos
Posts: 419
Joined: Thu Oct 15, 2009 3:43 pm

Re: Using C# DLLs in NeoBook

Post by Tony Kroos »

You may want to check this thread - http://stackoverflow.com/questions/2180 ... fresources
As stated in comments, there would be a variety of situations when handle becomes invalid and this error happens, in .net this could happen easily.
As far I can see, a call to nb interface doesn't block the flow of an executing function, so when function ends, some objects, variables, handles etc may be immediately destroyed. nb may not like that, especially if nb interface call is still executing.
So that's why I was asking about variables... If I should pin them in unmanaged memory block (that cannot be touched by net) that would be another approach, just trying to develop basic concepts of writing net plugins for nb.
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: Using C# DLLs in NeoBook

Post by Neosoft Support »

I haven't encountered this before with other languages, so it may be unique to C#. Normally, NeoBook shouldn't return from a function until it has finished executing - at least with plug-ins created in other languages. Any PChars you allocate and pass to NeoBook should not be released until the called NeoBook function returns. I think everything has to be unmanaged code since you're dealing with a Delphi app.
NeoSoft Support
Locked