static libs

The Partridge Family were neither partridges nor a family. Discuss.
MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: static libs

Post by MrGodin » March 3rd, 2017, 10:07 pm

Well tried a dll

Code: Select all

#define  MY_API __declspec(dllimport)// did dllexport in build project


//put the static fubctions by themselves in 
class   Mat3x3Construct
	{
	public:
		static MY_API Matrix3x3 Identity();
		static MY_API Matrix3x3 Rotation(float theta);
		static MY_API Matrix3x3 Scaling(float factor);
		static MY_API Matrix3x3 Translation(const Vector2D offset);
	};
stil compiles fine, bu tas soon as i got to use Matrix3x3 m_rot <-- calls this fine .. makes an instance
soon as i go m_rot = Mat3x3Constuct::Identity() <-- linker error
This is all in the lib/dll and works fine

Code: Select all

bw::Vec2f r = m_joint.rotation(angle);
r.normalize();
Curiosity killed the cat, satisfaction brought him back

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: static libs

Post by cameron » March 3rd, 2017, 10:19 pm

Try removing the MY_API on static funcs and apply to class itself.
Computer too slow? Consider running a VM on your toaster.

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: static libs

Post by MrGodin » March 4th, 2017, 2:30 am

Ya that didn't sove it either.. Ohh well, thanks for the suggestions though
Curiosity killed the cat, satisfaction brought him back

cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

Re: static libs

Post by cameron » March 4th, 2017, 3:12 am

Hmm. Idk basically this is what ive done in all my projects dll wise.

Code: Select all

#ifdef TCPCS_EXPORTS
#define CAMSNETLIB __declspec(dllexport)
#else
#define CAMSNETLIB __declspec(dllimport)
#endif
I define TCPCS_EXPORTS in dll proj under preproc.

Then all classes like "class CAMSNETLIB ClassName"

Are you exporting MATRIX3x3 too? Because if not it wont be able to resolve func(depending on the circumstances).
Computer too slow? Consider running a VM on your toaster.

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: static libs

Post by MrGodin » March 4th, 2017, 5:45 am

This is it here
Attachments
Dll2D.zip
(10.86 KiB) Downloaded 111 times
Curiosity killed the cat, satisfaction brought him back

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: static libs

Post by albinopapa » March 4th, 2017, 11:30 am

I was able to get an Identity matrix.

Headers stayed in Dll2D\Dll2D
Lib files stayed in the x64\Debug directory
Dll file got copied to the folder with the headers and source files for the testbed I was using.

Pointed the Library Directory to the Dll2D\x64\Debug directory for the .lib
Added this line before executing any code
#pragma comment(lib, "Dll2D.lib")
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: static libs

Post by MrGodin » March 4th, 2017, 4:26 pm

huh interesting, i'll give it a go
Curiosity killed the cat, satisfaction brought him back

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: static libs

Post by MrGodin » March 4th, 2017, 5:16 pm

nope, did as you stated albinopapa but with no favorable results.. Oh well, maybe i'll try a different approach.
Curiosity killed the cat, satisfaction brought him back

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: static libs

Post by albinopapa » March 4th, 2017, 6:49 pm

So it's saying that the symbols are unresolved? The only thing I can think of is it's not finding the lib file, but if it's working with the rest of the Mat3 functions, I can't imagine what the issue could be.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

MrGodin
Posts: 721
Joined: November 30th, 2013, 7:40 pm
Location: Merville, British Columbia Canada

Re: static libs

Post by MrGodin » March 4th, 2017, 9:03 pm

Unresolved linker error as soon as put a call to a static method, either in matrix class or the Intersect Class .. idk, i'll figure it out, probably a build configuration or something to that effect.
Curiosity killed the cat, satisfaction brought him back

Post Reply