mooman_fl
Centurion
As usual I am having a bit of trouble and I am hoping one of the gurus out there can shed some light. I think I know what the problem is, I just don't know how to fix it even after searching myself half blind.
I am working with a third-party DLL written in unmanaged code. I used DLL import to pull it into my project like so (yes it is a plugin for DarkBasic Pro if you recognized it):
The problem comes when I try to use the function. It works, then crashes immediately with an "System.AccessViolationException: Attempted to read or write protected memory."
If I Try/Catch this and bypass the error, the thing functions as it should, but crashes upon closing with an empty error dialog (no text, just an "Ok" button).
What that DLL does is call a function via a pointer in an unmanaged application. In this case, the application in question lables both Subs and Functions as a "Function" in my test code there was no return value.
I have looked up information on things like this but all I could find were references to similar problems where the imported function had a callback and was solved by making a delegate with the "UnmanagedFunctionPointer" attribute, however this function doesn't have a visible callback.
Any help or advice on how to solve this is appreciated. If you need more info or code just let me know.
I am working with a third-party DLL written in unmanaged code. I used DLL import to pull it into my project like so (yes it is a plugin for DarkBasic Pro if you recognized it):
Code:
<DllImport("Matrix1Util_20.dll", EntryPoint:="CallFunctionPtr", CallingConvention:=CallingConvention.Cdecl)> _
Friend Shared Sub CallFunctionPtr(ByVal FunctionPointer As Long)
End Sub
If I Try/Catch this and bypass the error, the thing functions as it should, but crashes upon closing with an empty error dialog (no text, just an "Ok" button).
What that DLL does is call a function via a pointer in an unmanaged application. In this case, the application in question lables both Subs and Functions as a "Function" in my test code there was no return value.
I have looked up information on things like this but all I could find were references to similar problems where the imported function had a callback and was solved by making a delegate with the "UnmanagedFunctionPointer" attribute, however this function doesn't have a visible callback.
Any help or advice on how to solve this is appreciated. If you need more info or code just let me know.