Issue #5193 has been updated by Charlie Savage.


Thanks Nobu for looking at this.

> The reason for _id2ref is that threads are stored in
> debug contexts as object IDs, and reversed when accessing 
> with checking if it's alive at same time. I have no
> idea why such roundabout way is used, and guess this
> could be simpler.

Could this be to avoid holding a reference to a thread object, and thus not allowing it to be GCed?

> Current state is https://github.com/nobu/ruby-debug/commit/4453c34537 

Great, thanks.  I have also taken your changes, except the id2ref ones, and have applied them to:

https://github.com/JetBrains/ruby-debug-base19/blob/master/ruby-debug-base19x.gemspec

With the changes, that version of ruby-debug now compiles and works on 1.9.3.

If rb_vm_make_env_object() and rb_vm_get_sourceline() are exported, would that solve the need for compiling against vm_core.h?
----------------------------------------
Bug #5193: ruby_thread_data_type linker errors fixed with RUBY_EXTERN
http://redmine.ruby-lang.org/issues/5193

Author: Charlie Savage
Status: Third Party's Issue
Priority: Normal
Assignee: Nobuyoshi Nakada
Category: core
Target version: 1.9.3
ruby -v: -


ruby-debug-base19x fails to compile with VC++ 2010 with this error:

ruby_debug.obj : error LNK2001: unresolved external symbol _ruby_thread_data_type

ruby_thread_data_type is declared in vm_core.h as:

extern const rb_data_type_t ruby_thread_data_type;

ruby-debug calls GetThreadPtr which is defined as:

#define GetThreadPtr(obj, ptr) \
    TypedData_Get_Struct((obj), rb_thread_t, &ruby_thread_data_type, (ptr))

What makes this interesting is that ruby_thread_data_type is properly included in the msvcr100-ruby191.def file and is exported from msvcr100-ruby191.dll.  Somehow the &ruby_thread_data_type causes problems for VC++ (mingw works correctly).  

Some Ubuntu users seem to be having a similar issue.  See:

http://rubyforge.org/tracker/index.php?func=detail&aid=29222&group_id=8883&atid=34290

The problem is resolved for VC++ by changing the definition to:

RUBY_EXTERN const rb_data_type_t ruby_thread_data_type;

Any chance this change could be made?

Thanks - Charlie


-- 
http://redmine.ruby-lang.org