From: Michael Hale Date: 2004-08-19T03:04:46+09:00 Subject: Re: c extension troubles on windows I updated my code to remove the initial underscores and removed the int cast. The only compiler warnings are about unsupported optimization options. What could be wrong with the linking step? Here is my compile and link output: Microsoft (R) Program Maintenance Utility Version 7.10.3077 Copyright (C) Microsoft Corporation. All rights reserved. cl -nologo -MD -Zi -O2b2xg- -G6 -I. -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -Ic:/ruby/lib/ruby/1.8/i386-mswin32 -I. -IC:/Views/michaelh_ips3.0_priv/Software/tools/ciphero/ com.cipheroptics.smartlib/win32/include -I. -I./.. -I./../missing -c -Tcsmartlib_wrap.c cl : Command line warning D4029 : optimization is not available in the standard edition compiler cl : Command line warning D4002 : ignoring unknown option '-Og-' smartlib_wrap.c cl -nologo -LD -Fesmartlib.so smartlib_wrap.obj msvcrt-ruby18.lib smbw32vc.lib oldnames.lib user32.lib advapi32.lib wsock32.lib -link -incremental:no -debug -opt:ref -opt:icf -dll -libpath:"C:/Views/michaelh_ips3.0_priv/Software/tools/ciphero/ com.cipheroptics.smartlib/win32/lib" -libpath:"c:/ruby/lib" -def:smartlib-i386-mswin32.def Creating library smartlib.lib and object smartlib.exp On Aug 18, 2004, at 8:08 AM, Paul Brannan wrote: > On Wed, Aug 18, 2004 at 05:42:59AM +0900, Michael Hale wrote: >> static VALUE >> _wrap_NSSocketLink(int argc, VALUE *argv, VALUE self) { > > All identifiers that begin with an underscore are reserved for use by > the compiler. This probably isn't your problem, but you should remove > the leading underscore anyway. > >> char *arg1 ; >> int arg2 ; >> int arg3 ; >> int result; >> VALUE vresult = Qnil; >> >> if ((argc < 3) || (argc > 3)) >> rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); >> arg1 = StringValuePtr(argv[0]); >> arg2 = NUM2INT(argv[1]); >> arg3 = NUM2INT(argv[2]); >> printf("before\n"); >> result = (int)NSSocketLink(arg1,arg2,arg3); > > This cast should be unnecessary. If your compiler is giving you > warnings, adding a cast here just hides the problem (namely that you > may > have forgotten to include the header that declares NSSocketLink). > > If this doesn't help, then perhaps there is something wrong with the > linking step? > > Paul > > > > "OS X: because it was easier to make UNIX user-friendly than to fix Windows"