c# - How should I expose an object orientated library to excel without registering DLLs? -
i'm developing object-oriented c++ library expose functionality of users in excel. ideally use library within excel vb , provide higher-level functions can expose through spreadsheet.
i have written c-api c++ library it's awkward use objects require explicit create/dispose calls.
using c-api, have constructed python api create/dispose calls handled python classes. python api can used build higher level functions , expose them user through ipython notebook. ipython notebook can configured load python modules , specify path on dll loaded without admin rights:
import sys sys.path.insert(0,notebook_directory) import mylib mylib.config_library_path(notebook_directory) #used dll loading ctypes
this means can distribute notebook self contained entity. need same excel document , dlls distribute it.
i can write c# bindings around c-api in same way did python cannot see how c# dll loaded excel without global dll registration.
i can use c-api create xll , declare functions in vb means have handle memory management within excel vb.
what options available creating self-contained excel tool did ipython notebook?
you asking vague question complicated decision tree:
- how expose c library excel. have 2 choices, either worksheet functions , macros, or vba environment.
- for worksheet functions, you'd make xll using 1 or many c/c++ toolkits, e.g. xlw or xll+, or .net wrapper , excel-dna, or python pyxll.
- for vba integration, must either expose flat c api consume via declare statements in vba, or expose com library.
- the com library can written in c++ or .net.
- the com library can registered , loaded user permissions, if take care of registration yourself. excel-dna kind of non-admin registration com classes exposed excel-dna add-ins. can done com library.
you should this:
- write vba declares reference c api directly, though correct use bit awkward. use loadlibrary make sure .dlls load relative workbook location.
- make high-level vba helper classes wrap these c calls.
- ship .xlam add-in.
Comments
Post a Comment