Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

Loading a .dll at startup

Anonymous

Loading a .dll at startup

Anonymous
No aplicable

I've seen the the article at https://knowledge.autodesk.com/support/autocad/troubleshooting/caas/sfdcarticles/sfdcarticles/How-to..., but i'm still having troubles getting the .dll to load at startup.

Where in the file acad20xxdoc.lsp do I put my netload command? That file for me is located at C:\Program Files\Autodesk\Autodesk AutoCAD Map 3D 2014\Support\en-us, does that make a difference?

 

I know the .dll works because I can type netload in the command bar, browse to it, and it loads.

0 Me gusta
Responder
Soluciones aceptadas (1)
6.229 Vistas
4 Respuestas
Respuestas (4)

rkmcswain
Mentor
Mentor

Do not edit that file. Create a new file named "acaddoc.lsp" and put your code in there. For greater flexibility, create a new folder (for example: C:\CADSTUFF) and put your "acaddoc.lsp" file in there, then add this folder to the TOP of your support file search path.

Done.

As for the contents of this file, you can do it like this:

(setq dllFile (strcat MyPath "DGNPurge.dll"))
(if (findfile dllFile)(vl-cmdf "netload" dllFile))


Or you might choose to do something like this (demand load it)

(defun c:myFunc ()
  (vl-cmdf "netload" (strcat DllPath "MyFunc.dll"))
  (vl-cmdf "MyFunc")
)



Doing it this way only loads the DLL if the function is called.

R.K. McSwain     | CADpanacea | on twitter

dgorsman
Consultant
Consultant
Solución aceptada

A little disappointed at that KB - somewhere between bad practices and wrong.

 

Do NOT use the LSP files with the version number in the name (ACAD____.LSP, ACADDOC____.LSP).  Those are reserved for use by the program.  Create your own ACAD.LSP and ACADDOC.LSP files, which will execute when the program loads (ACAD.LSP) and when each document loads (ACADDOC.LSP).  Since DLLs are loaded for the session and cannot be unloaded, that should only be used with the former.

 

But I would recommend you use the Option B provided - set up a registry key for demand loading, or look into creating an auto-loader bundle.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


0 Me gusta

Anonymous
No aplicable

I ended up using the registry setting to do it, it seemed easier in the end.

Thank you for the answers.

0 Me gusta

rkmcswain
Mentor
Mentor
dgorsman wrote:

A little disappointed at that KB - somewhere between bad practices and wrong.

Wow, I just went and read that "kb" article.

Unbelievable. That information is no better than a random forum post or something you find on reddit, etc.

The KB articles are supposed to be gold, trustworthy information. They used to be years ago. Oh well....

R.K. McSwain     | CADpanacea | on twitter
0 Me gusta