Author Topic: Problem loading DLL written ot MSVC++  (Read 1772 times)

0 Members and 1 Guest are viewing this topic.

dodimitrov

  • Guest
Problem loading DLL written ot MSVC++
« on: November 12, 2015, 01:41:19 AM »
Hi everyone,
I need to load external DLL in my lisp to do some calculations.Formulas and parameters are specific - cant implement in lisp.
The library was developed as dynamic library, written on Microsoft Visual C++.
I have detailed description of all three functions in DLL:

extern "C" __declspec(dllexport) long __stdcall
InitializeAllTheStuff(const char* par1, const char* par2)

extern "C" __declspec(dllexport) long __stdcall
DoTheCalc(int p1, int *z, double *a, double *b)

extern "C" __declspec(dllexport) long __stdcall
FreeStuff()

The last one is required after using "DoTheCalc" function

I have reviewed related topics and I'm trying something like this:

(defun C:loadmydll(/)
  (vlax-invoke 
      (vla-GetInterfaceObject
            (vlax-get-acad-object) "path\mydll.dll") 'InitializeAllTheStuff "p1" "p2")           
             
)



squirreldip

  • Newt
  • Posts: 114
Re: Problem loading DLL written ot MSVC++
« Reply #1 on: November 12, 2015, 06:24:19 PM »
Is the path to your .dll a trusted location?

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Problem loading DLL written ot MSVC++
« Reply #2 on: November 12, 2015, 07:14:56 PM »
What are the errors you are receiving?
Is the dll the same file version as the CAD platform?

We will need some more information I'm afraid, you have only posted the goals of your experiment but no findings to date which would help in diagnosing your issue/s.

cheers.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Problem loading DLL written ot MSVC++
« Reply #3 on: November 12, 2015, 09:51:42 PM »
The library was developed as dynamic library, written on Microsoft Visual C++.

Lisp cannot call C functions. To use those functions from Lisp, you'll need to write either a COM wrapper that exposes them via COM or an ObjectARX wrapper that exposes them via lisp function.

dodimitrov

  • Guest
Re: Problem loading DLL written ot MSVC++
« Reply #4 on: November 13, 2015, 02:25:22 AM »
Thank's Owen!
I thought so. I’ll need help with that – not familiar to me.