SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: Tommy6502 on February 08, 2017, 05:07:16 PM

Title: Dynamic shared DLL library Interface simple.cpp for MacOSX sample
Post by: Tommy6502 on February 08, 2017, 05:07:16 PM
I would like to create an extension shared library on MacOSX.  I found the simple.cpp file in the samples directory.

When I try to build it using this command, I received unresolved external symbols:

clang++ -fPIC -I/Applications/SlickEditPro2016.app/Contents/h simple.o -dynamiclib -o libsimple.so
Undefined symbols for architecture x86_64:
  "_vsDeleteLine", referenced from:
      _dllcommand in simple.o
  "_vsDllExport", referenced from:
      _vsDllInit in simple.o
  "_vsExecute", referenced from:
      _dllcommand in simple.o
  "_vsInsertLine", referenced from:
      _dllcommand in simple.o
  "_vsMessageBox", referenced from:
      _dllcommand in simple.o
  "_vsPropSetI64", referenced from:
      _dllcommand in simple.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I know the symbols are in the vs binary.  How do I tell the linker to link to it? Is there a SlickEdit library I need to link with? Does anyone have a working makefile for MacOS that will successfully build the shared extension library interface to SlickEdit?

Is this known to work on MacOSX?

Thank you.
Title: Re: Dynamic shared DLL library Interface simple.cpp for MacOSX sample
Post by: Tommy6502 on February 08, 2017, 05:28:46 PM
I am able to build it using this command:

gcc -bundle simple.o -o simple -bundle_loader /Applications/SlickEditPro2016.app/Contents/MacOS/vs

It successfully builds the bundle binary file simple:

# file simple
simple: Mach-O 64-bit bundle x86_64

How do I load it into SlickEdit?

Title: Re: Dynamic shared DLL library Interface simple.cpp for MacOSX sample
Post by: patrick on February 09, 2017, 05:27:25 PM
Sorry in the delay in answering this, I started to look into it, and then fell down a rabbit hole.

The dload command is used to load extension DLL's, but it is not implemented for Unix & MacOS.  I do not know yet why that sample has *nix makefiles, that's probably a mistake.
Title: Re: Dynamic shared DLL library Interface simple.cpp for MacOSX sample
Post by: Clark on February 10, 2017, 02:39:51 AM
Like Patrick said, the DLL interface is currently only supported on windows.

What feature are you trying to add?
Title: Re: Dynamic shared DLL library Interface simple.cpp for MacOSX sample
Post by: Tommy6502 on February 14, 2017, 01:34:10 AM
Thank you for the response.  After learning more about SlickC, I actually figured out how to implement it with SlickC.