Jump to content

VLA-GETINTERFACEOBJECT on 64 bit Windows 7


tfurness

Recommended Posts

(SETQ obj (VLA-GETINTERFACEOBJECT (VLAX-GET-ACAD-OBJECT) "CadLisp.Lisp"))

 

I am trying to get this to work on our new 64bit Windows 7 machine (Map 2012).

It has been working fine on our existing XP machines (Map2009) for the last year.

 

When I run this, I get the following error;

(SETQ obj (VLA-GETINTERFACEOBJECT (VLAX-GET-ACAD-OBJECT) CadLisp.Lisp"))

error: Automation Error. Problem in loading application

 

"CadLisp.Lisp" is a com object which runs just fine at a command prompt with vb script.

 

Does anyone have any suggestions?

 

Thanks in advance

Link to comment
Share on other sites

If it runs fine in VBScript, then perhaps try using vlax-get-or-create-object instead - it's the same principle as VBS's CreateObject function. Just make sure to use vlax-release-object when you're done with it.

Link to comment
Share on other sites

If it runs fine in VBScript, then perhaps try using vlax-get-or-create-object instead - it's the same principle as VBS's CreateObject function. Just make sure to use vlax-release-object when you're done with it.

 

FWIW -

 

_$ (setq obj (vlax-get-or-create-object "CadLisp.Lisp"))
nil

Link to comment
Share on other sites

RM, the OP did state that the "CadLisp.Lisp" COM object works in vb script for him. Which means it's some ActiveX/COM program / library which has been registered on his PC. I'm unfamiliar with such myself, and I also get a nil return when trying this. But if it works for him in VBS, then there should be no reason why it shouldn't work in Visual Lisp on the same PC as well.

Link to comment
Share on other sites

Thanks for your replies. Some additional information..

 

Cadlisp.lisp is a custom COM object we wrote to access our custom .net assembly that talks to our database.

 

We Load the dll using this code

 

 

 
(DEFUN load-cadlisp (/ server)
   (PROGN (VL-LOAD-COM)
       (SETQ server (CoGetClassServer cl:progid))
    (IF (NOT server)
        (ALERT "Error: no good")
     (PROGN (VLAX-IMPORT-TYPE-LIBRARY
         :TLB-FILENAME
       Server
       :METHODS-PREFIX
      cl:prefix
      :PROPERTIES-PREFIX
      cl:prefix
     :CONSTANTS-PREFIX
      (STRCAT ":" cl:prefix)
                  )
            );_Progn
          );_if
   );_Progn
);_DEFUN load-cadlisp

(DEFUN CoGetClassServer (progid) (CoGetClassProperty progid "InprocServer32")) ;_DEFUN CoGetClassServer

(DEFUN CoGetClassProperty (ProgID property / clsid)
 (IF (SETQ clsid (ProgID->CLSID ProgID))
   (VL-REGISTRY-READ
     (STRCAT "HKEY_CLASSES_ROOT\\WOW6432NODE\\CLSID\\" clsid "\\" property)
     )
   )
 ) ;_DEFUN CoGetClassProperty

(DEFUN ProgID->CLSID (ProgID)
 (VL-REGISTRY-READ (STRCAT "HKEY_CLASSES_ROOT\\" progid "[url="file://clsid/"]\\CLSID[/url]"))
 ) ;_DEFUN ProgID->CLSID
;; load cadlisp DLL

 

We have many functions in the dll such as follows

 

 
(DEFUN GetAPNameOverride (corpnum indx)
 (SETQ obj (VLA-GETINTERFACEOBJECT (VLAX-GET-ACAD-OBJECT) cl:progid))
 (SETQ res (ap-GetAPNameOverride obj corpnum indx)) ;_res NameOverride   
 ) ;_defun GetAPNameOverride 

 

for our new 64 bit machine, the load dll portion apperars to work after we added

WOW6432NODE to the registry path.

 

however the functions fail at

 
(SETQ obj (VLA-GETINTERFACEOBJECT (VLAX-GET-ACAD-OBJECT) cl:progid))

 

There are many of these type of functions that have been working fin in our 32 bit environment for the past year or two. But nowe on the new 64 bit machine, it is failing. ( as I said before, the COM wrapper(Cadlisp) works just fine from vb script) I surmise it has something to do with 64bit Acad loading a 32 bit Dll but I am not really sure how all this works. Any Ideas?

 

btw, we did try

 
$ (setq obj (vlax-get-or-create-object "CadLisp.Lisp"))

and this failed too

 

 

 

Thanks again in advance

Link to comment
Share on other sites

I am trying to get this to work on our new 64bit Windows 7 machine (Map 2012).

It has been working fine on our existing XP machines (Map2009) for the last year.

 

Cadlisp.lisp is a custom COM object we wrote to access our custom .net assembly that talks to our database.

 

... Sounds like a problem with your custom code, methinks.

 

Did you recompile your assembly, after updating to the Map ObjectARX SDK 2012, and/or ObjectARX 2012 SDK references, or are you still referencing the 2009 SDK(s)? :unsure:

Link to comment
Share on other sites

I think RM is onto your problem - my only experience using VLA-GETINTERFACEOBJECT was accessing a template file and the only issue I had was after upgrading to AutoCAD 2013 where the old code was looking to interface with a 2010 file.

Link to comment
Share on other sites

I think RM is onto your problem - my only experience using VLA-GETINTERFACEOBJECT was accessing a template file and the only issue I had was after upgrading to AutoCAD 2013 where the old code was looking to interface with a 2010 file.

 

... 2013 has the added issue _requirement_ of adding a reference to AcCoreMgd.dll, as Core Console gets added into the mix. :ouch:

Link to comment
Share on other sites

FWIW -

 

If none of the suggestions above are able to help resolve the problem, you may need to post the source code for CadLisp here.

 

If posting the source code publicly is not an option, feel free to PM individual(s) the Visual Studio solution(s).

 

When doing so, it is preferred that you do not just attach, or send the compiled assembly, and instead provide source code so that we may review, and compile ourselves, prior to NETLOADing the assembly. :thumbsup:

Link to comment
Share on other sites

The issue(s) were;

 

1. re-complile the assembly as x64

2. regasm64 the assembly

3. re-compile the COM objects as x64 and set installer properties to COMSelfReg

 

Everything is working fine now in the 64 bit environment.

Lisp is able to create the COM object and query or database as it was in the 32 bit environment.

 

Thanks for all you input.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...