Page 3 of 3

Re: Using C# DLLs in NeoBook

Posted: Wed Jul 01, 2015 11:24 am
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.

Re: Using C# DLLs in NeoBook

Posted: Wed Jul 01, 2015 1:36 pm
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.

Re: Using C# DLLs in NeoBook

Posted: Thu Jul 02, 2015 9:46 am
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.