From: DanB on

I have a dll with managed code and just one managed class. The other
classes use gcroot<> for the managed stuff.

I've got it all working but for one member function during linking.

public ref class DataSet
{
size_t size;
array< double >^ data;

public:
DataSet( )
:size( 30 )
{
data= gcnew array< double >( size );
}
void InputTabbedData( LPCTSTR pzIn );
operator array< double >^ ( ) { return data; }
array< double >^ get( ) { return data; }
};

~~~
error LNK2020: unresolved token (0600000C) DataSet::InputTabbedData...

I just don't know how to make the member export. And the class does
export, no error there. From what I've read the puplic on the class
should have done it. I'm very new to managed code. :)

This is an MFC dll.

Thanks, Dan.

From: David Lowndes on
>public ref class DataSet
>{
> size_t size;
> array< double >^ data;
>
>public:
> DataSet( )
> :size( 30 )
> {
> data= gcnew array< double >( size );
> }
> void InputTabbedData( LPCTSTR pzIn );
> operator array< double >^ ( ) { return data; }
> array< double >^ get( ) { return data; }
>};
>
>~~~
>error LNK2020: unresolved token (0600000C) DataSet::InputTabbedData...

Dan,

Where is the implementation of DataSet::InputTabbedData? All you've
shown is the definition (though other members are implemented there).

Dave
From: DanB on
David Lowndes wrote:
>> public ref class DataSet
>> {
>> size_t size;
>> array< double>^ data;
>>
>> public:
>> DataSet( )
>> :size( 30 )
>> {
>> data= gcnew array< double>( size );
>> }
>> void InputTabbedData( LPCTSTR pzIn );
>> operator array< double>^ ( ) { return data; }
>> array< double>^ get( ) { return data; }
>> };
>>
>> ~~~
>> error LNK2020: unresolved token (0600000C) DataSet::InputTabbedData...
>
> Dan,
>
> Where is the implementation of DataSet::InputTabbedData? All you've
> shown is the definition (though other members are implemented there).

It is defined with all the members of the unmanaged classes. If I
compile with that cpp file, everything is fine, I have access to the
member and can make charts with it.

The reason I want to put the code in a dll is so I can delay load it.
That way if the client doesn't have .net3.5 sp1 and mscharts installed
properly, for what ever reason, it won't keep my app from running. We
still support the old charting for now.

So I moved the code to the class, wasn't a lot, now it links. And
something I had run into while reading that I have to fix now...

~~~
Managed Debugging Assistant 'LoaderLock' has detected a problem in
'c:\cpp\ReserveAnalyst_Charts\Debug\Chart.exe'.
Additional Information: DLL
'c:\cpp\ReserveAnalyst_Charts\Debug\ChartMaker.dll' is attempting
managed execution inside OS Loader lock. Do not attempt to run managed
code inside a DllMain or image initialization function since doing so
can cause the application to hang.
~~~

Chart.exe is an unmanaged mfc dialog app to test the code with.

Learning c# and managed c++ has been a wild journey!


Best, Dan.
From: DanB on
DanB wrote:
>
> Chart.exe is an unmanaged mfc dialog app to test the code with.

xnay, sorry, this was not true. And it looks like I'm not going to get
away with this path. I'm thinking I'll just go back to plan 'A' and the
chart maker will run as a separate process from the app, no dll.

Best, Dan.