Skip to content

Commit

Permalink
Platform independent python3 import for C
Browse files Browse the repository at this point in the history
Relies on the python3-config tool, some exploration in how to pass
libraries directly to the linker with ponyc seems to require a
complete redefinition through the --linker flag.
  • Loading branch information
caj-larsson committed Aug 15, 2018
1 parent 81f3788 commit 3950e44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion machida/Makefile
Expand Up @@ -48,6 +48,8 @@ MACHIDA_BUILD = $(MACHIDA_PATH)/build
MACHIDA_CPP = $(MACHIDA_PATH)/cpp
WALLAROO_LIB = $(wallaroo_path)/lib

PYTHON3_INCLUDES = $(shell python3-config --includes)

# Our top level Makefile has 3 rules that would have been generated for us if
# we hadn't turned them off at the top of the Makefile. Here we recreate them
# with our own custom rules. This allows the top level commands like
Expand Down Expand Up @@ -80,7 +82,7 @@ $(MACHIDA_BUILD)/libpython-wallaroo.a: $(MACHIDA_BUILD)/python-wallaroo.o

$(MACHIDA_BUILD)/python-wallaroo.o: $(MACHIDA_CPP)/python-wallaroo.c
$(QUIET)mkdir -p $(MACHIDA_BUILD)
$(QUIET)cc -g -o $(MACHIDA_BUILD)/python-wallaroo.o -c $(MACHIDA_CPP)/python-wallaroo.c
$(QUIET)cc -g -o $(MACHIDA_BUILD)/python-wallaroo.o $(PYTHON3_INCLUDES) -c $(MACHIDA_CPP)/python-wallaroo.c

# end of prevent rules from being evaluated/included multiple times
endif
2 changes: 1 addition & 1 deletion machida/cpp/python-wallaroo.c
Expand Up @@ -16,7 +16,7 @@ Copyright 2017 The Wallaroo Authors.
*/

#include <python3.5m/Python.h>
#include <Python.h>


PyObject *g_user_deserialization_fn;
Expand Down

0 comments on commit 3950e44

Please sign in to comment.