Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation fix for Windows ( and some small cleanups ) #212

Merged
merged 5 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/oci8/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ static sb4 in_bind_callback(void *ictxp, OCIBind *bindp, ub4 iter, ub4 index, vo

if (cb->tail == &cb->head) {
/* empty string */
*bufpp = "";
*bufpp = (void *)"";
*alenp = 0;
*piecep = OCI_ONE_PIECE;
} else {
Expand Down
1 change: 1 addition & 0 deletions ext/oci8/oci8.h
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ void *oci8_check_typeddata(VALUE obj, const oci8_handle_data_type_t *data_type,
extern VALUE eOCIException;
extern VALUE eOCIBreak;
void Init_oci8_error(void);
NORETURN(void oci8_do_raise(OCIError *errhp, sword status, OCIStmt *stmthp, const char *file, int line));
NORETURN(void oci8_do_env_raise(OCIEnv *envhp, sword status, int free_envhp, const char *file, int line));
NORETURN(void oci8_do_raise_init_error(const char *file, int line));
sb4 oci8_get_error_code(OCIError *errhp);
Expand Down
6 changes: 3 additions & 3 deletions ext/oci8/oraconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -995,16 +995,16 @@ def initialize(inc_dir, lib_dir)
init

if RUBY_PLATFORM =~ /mswin32|mswin64|cygwin|mingw32|bccwin32/ # when Windows
unless File.exist?("#{ic_dir}/sdk/lib/msvc/oci.lib")
unless File.exist?("#{lib_dir}/sdk/lib/msvc/oci.lib")
raise <<EOS
Could not compile with Oracle instant client.
#{ic_dir}/sdk/lib/msvc/oci.lib could not be found.
#{lib_dir}/sdk/lib/msvc/oci.lib could not be found.
EOS
raise 'failed'
end
@cflags = " \"-I#{inc_dir}\""
@cflags += " -D_int64=\"long long\"" if RUBY_PLATFORM =~ /cygwin|mingw32/
@libs = get_libs("#{ic_dir}/sdk/lib")
@libs = get_libs("#{lib_dir}/sdk/lib")
ld_path = nil
else
@cflags = " -I#{inc_dir}"
Expand Down
7 changes: 5 additions & 2 deletions lib/oci8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
# Cygwin manages environment variables by itself.
# They don't synchroize with Win32's ones.
# This set some Oracle's environment variables to win32's enviroment.
require 'Win32API'
win32setenv = Win32API.new('Kernel32.dll', 'SetEnvironmentVariableA', 'PP', 'I')
require 'fiddle'
win32setenv = Fiddle::Function.new( Fiddle.dlopen('Kernel32.dll')['SetEnvironmentVariableA'],
[Fiddle::TYPE_VOIDP,Fiddle::TYPE_VOIDP],
Fiddle::TYPE_INT )

['NLS_LANG', 'TNS_ADMIN', 'LOCAL'].each do |name|
val = ENV[name]
win32setenv.call(name, val && val.dup)
Expand Down
2 changes: 1 addition & 1 deletion setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def ConfigTable.load

def initialize_from_table
@table = {}
DESCRIPTER.each do |k, (default, vname, desc, default2)|
DESCRIPTER.each do |k, (default, *)|
@table[k] = default
end
end
Expand Down