Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I debug an r(9999) error when loading a C plugin?

    I'm following the instructions here (http://www.stata.com/plugins/ ) for creating a Stata plugin. I'm using Stata 14.1 MP on a Windows 7 64-bit machine, and Visual Studio 2012. I downloaded hello.c, stplugin.c, and stplugin.h, followed the instructions for creating a C DLL project in Visual Studio, and compiled the plugin. It compiled successfully. However, when I place "hello.dll" in my working directly and run this code in a do-file:

    Code:
    capture program drop myhello
    program myhello, plugin using("hello.dll")
    plugin call myhello
    I get this error:
    Code:
    Could not load plugin: .\hello.dll
    r(9999);
    The error code -r(9999)- doesn't have a help file either. How do I begin debugging an error like this? The C plugin compiles successfully, the do-file and the resulting DLL file are placed in the same directory, and as far as I can tell, I'm following the instructions from Statacorp correctly. Where do I start? The -r(9999)- error message isn't helpful, and there aren't any debugging instructions on Statacorp's page.

    Where do I start looking for the problem? Without any information besides "Could not load plugin", I don't even know how to begin debugging this.
    Last edited by Michael Anbar; 21 Dec 2015, 12:55.

  • #2
    Have you tried specifying an absolute path to the dll file?

    Comment


    • #3
      Originally posted by wbuchanan View Post
      Have you tried specifying an absolute path to the dll file?
      Yes. I get the same error.

      Comment


      • #4
        If your Stata is 64bit, you need compile the dll as 64bit instead of 32bit. To find out if your Stata is 64bit or 32bit, type -about- in Stata command Window.

        Comment


        • #5
          Originally posted by Hua Peng (StataCorp) View Post
          If your Stata is 64bit, you need compile the dll as 64bit instead of 32bit. To find out if your Stata is 64bit or 32bit, type -about- in Stata command Window.
          That was precisely the problem. Thank you!

          Comment

          Working...
          X