opscode/dep-selector — pull request #15 by danielsdeleo (2014-04-08 02:01:49+00:00)
Title: Define a dummy init function for ruby's build to export

Compiling on windows requires us to have a function named `Init_dep_gecode` even though we'll never call it. Without this function, installing the latest dep_selector fails on windows with:

```
Cannot export Init_dep_gecode: symbol not defined
```

The Makefile generated on windows contains:

```
$(DEFFILE):
$(ECHO) generating $(@)
$(Q) $(RUBY) -e "puts 'EXPORTS', '$(TARGET_ENTRY)'" > $@
```
Where:

```
# snip
dldflags = -Wl,--enable-auto-image-base,--enable-auto-import $(DEFFILE)
# snip
TARGET_NAME = dep_gecode
TARGET_ENTRY = Init_$(TARGET_NAME)
# snip
$(DLLIB): $(DEFFILE) $(OBJS) Makefile
$(ECHO) linking shared-object $(DLLIB)
-$(Q)$(RM) $(@)
$(Q) $(LDSHAREDXX) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
```

This isn't really fixable in `mkmf`, it's easier if we just export this function, event though it's an ugly solution.